📜  git list stashes - Shell-Bash (1)

📅  最后修改于: 2023-12-03 15:15:17.687000             🧑  作者: Mango

git list stashes - Shell-Bash

git list stashes is a command in Git that lists all the stashes in the repository. A stash is a temporary and hidden place in Git where you can save changes without committing them or creating a new branch. It is handy for storing unfinished work or for making backups of your work.

How to Use git list stashes

To list all the stashes in the repository, simply enter the following command in your terminal:

git stash list

This will return a list of all the stashes in your repository, with each stash represented by a unique identifier (e.g. stash@{0}) and a message describing the changes that were stashed.

Additional Options

There are several options that you can use with git stash list to customize the output:

  • --pretty: Changes the format in which the stash information is displayed.
  • --date: Specifies the date format to use in the output.
  • --grep: Filters the list based on a regular expression.
  • --invert-grep: Inverts the grep filter.
  • --max-count: Limits the number of stashes in the output.

For example, you can use the --pretty option to display the stashes in a detailed format:

git stash list --pretty=fuller

This will show additional information about each stash, such as the commit that was stashed:

stash@{0}: WIP on master: 7a86757 Add new feature
Conclusion

git list stashes is a useful command that allows you to see all the stashes in your Git repository. It is helpful for managing your work and keeping track of changes that are not yet committed. By using the additional options, you can customize the output to suit your needs.