In software development, sometimes you need to quickly switch tasks — but you don’t want to lose the changes you’ve made. That’s where git stash
comes in handy.
Git’s stash feature lets you temporarily save your uncommitted changes and come back to them later. And if you’ve stashed multiple times, you might be wondering: How do I see what I’ve stashed?
That’s where git stash list
comes in.
🧠 What Is Git Stash?
git stash
is used to temporarily shelve (or stash) changes you’ve made to your working directory so you can work on something else and come back to them later.
Example:
git stash
This command saves your uncommitted changes and cleans your working directory.
🔍 How to View Your Stashed Changes
✅ Use git stash list
To view all stashed changes, use:
git stash list
This will return a list that looks like this:
stash@{0}: WIP on main: 123abc9 Add login form
stash@{1}: WIP on main: 456def1 Update readme
stash@{2}: WIP on feature-branch: 789ghi2 Refactor navbar
Each line represents a stash, with:
- A unique identifier (e.g.,
stash@{0}
) - The branch name it was created from
- The commit hash and message at the time of the stash
🧪 View the Content of a Specific Stash
If you want to see what’s inside a stash, use:
git stash show stash@{0}
This will give you a summary of the changes (like git diff
). For a more detailed diff, add the -p
flag:
git stash show -p stash@{0}
📂 Apply or Pop a Stash
Once you’re ready to retrieve the changes:
- Apply (keeps the stash after applying):
git stash apply stash@{0}
- Pop (applies and removes from stash list):
git stash pop stash@{0}
🗑️ Delete a Stash
To delete a stash you no longer need:
git stash drop stash@{0}
To clear all stashes:
git stash clear
🧭 Summary of Useful Commands
Command | Description |
---|---|
git stash list | Show all stashes |
git stash show stash@{n} | View what’s in a specific stash |
git stash show -p stash@{n} | View full diff of a stash |
git stash apply stash@{n} | Apply a stash without removing it |
git stash pop stash@{n} | Apply and remove a stash |
git stash drop stash@{n} | Delete a specific stash |
git stash clear | Delete all stashes |
🚀 Final Thoughts
git stash list
is a simple but powerful way to keep track of your saved work in progress. Whether you’re multitasking on multiple features or pausing a bug fix to review code, stashing helps you stay flexible without losing progress.
Understanding how to view and manage stashes keeps your workflow smooth and stress-free — especially in fast-moving projects.