How to List Stashes in Git: Simple Commands Explained
Use the
git stash list command to see all your saved stashes in Git. This shows a list of stash entries with their names and messages.Syntax
The basic command to list all stashes is git stash list. It shows each stash with an identifier and a message.
git stash: The main command for stash operations.list: The action to display all saved stashes.
bash
git stash list
Example
This example shows how to create a stash and then list all stashes to see it.
bash
git stash push -m "work in progress" git stash list
Output
stash@{0}: On main: work in progress
Common Pitfalls
Sometimes users expect git stash list to show detailed file changes, but it only shows stash names and messages. To see details, use git stash show with the stash name.
Also, forgetting to create a stash before listing will show an empty list.
bash
git stash list
# Shows stash names only
git stash show stash@{0}
# Shows changes in the first stashQuick Reference
| Command | Description |
|---|---|
| git stash list | List all saved stashes with names and messages |
| git stash show stash@{n} | Show changes in a specific stash |
| git stash push -m "message" | Create a new stash with a message |
| git stash pop | Apply and remove the latest stash |
Key Takeaways
Use
git stash list to see all your saved stashes with their names.Stash entries are shown as
stash@{n} with a message describing the changes.To see what changes a stash contains, use
git stash show with the stash name.If no stashes exist,
git stash list will show nothing.Always create a stash first before trying to list it.