How to Use Git Stash: Save, List, Apply, and Drop Changes
Short answer
git stash captures your current uncommitted changes — both staged and unstaged — and saves them on a private stack, reverting your working directory to the last committed state. Run git stash (or git stash push) to save; use git stash push -m "description" to attach a label. To restore the most recent stash and remove it from the stack, run git stash pop; to apply it without removing it, use git stash apply. Reference a specific entry by index: git stash pop stash@{2}. View all stash entries with git stash list; inspect what a specific entry contains with git stash show -p stash@{N}. By default, git stash ignores untracked files — use git stash -u to include them, or git stash --all to also include ignored files. To stash only specific files, use git stash push -- file1.js file2.js. Stash entries are stored locally and are never pushed to a remote.
Run git stash to temporarily save your uncommitted changes and revert to a clean working copy - then git stash pop later to bring them back. It's the standard way to switch branches or pull remote changes without committing half-finished work.
That's the two commands most people need. Below: how to label and manage multiple stashes, what happens to untracked files, and - if you'd rather not touch the command line - how stashing works visually in Tower.
The Git Cheat Sheet
No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!
Free. We email you a ZIP with our cheat sheets.
When to Use git stash
| Scenario | Why stash helps |
|---|---|
| Switching branches mid-work | You need a clean working copy to check out another branch |
| Pulling remote changes | Your local edits conflict with incoming changes from git pull |
| Testing a clean state | You want to verify something works without your uncommitted changes |
| Quick experiments | You want to try something without committing unfinished work |
Saving Changes with git stash
Let's say you currently have a couple of local modifications:
git status
modified: index.php
modified: css/styles.css
If you have to switch context — e.g. because you need to work on an urgent bug — you need to get these changes out of the way without committing unfinished work. This is where git stash comes in handy:
git stash
Saved working directory and index state WIP on master:
2dfe283 Implement the new login box
HEAD is now at 2dfe283 Implement the new login box
Your working copy is now clean. You're ready to start your new task.
Add a descriptive message with git stash push -m to make entries easier to identify later:
git stash push -m "login feature WIP"
Restoring Changes: git stash pop and apply
When you're ready to continue where you left off, restore the saved state with git stash pop:
git stash pop
pop reapplies the most recent stash entry and removes it from the stack. To apply a specific entry (not the most recent), provide its index:
git stash pop stash@{2}
Note: There is no git unstash command. To restore stashed changes, always use git stash pop or git stash apply.
If you want to restore your changes but keep them on the stack (e.g. to apply the same changes to multiple branches), use apply instead:
git stash apply
| Command | Restores changes | Removes from stack |
|---|---|---|
git stash pop |
Yes | Yes |
git stash apply |
Yes | No |
You can also preserve your staged files in the working directory while stashing everything else:
git stash push --keep-index
Listing and Inspecting Stash Entries
When you accumulate multiple stashes, git stash list shows them all:
$ git stash list
stash@{0}: On main: New sidebar
stash@{1}: On main: Blog template
stash@{2}: On feature/affiliate-program: Affiliate Program page
stash@{3}: WIP on main: c953ca6 Add HTML boilerplate
You can limit the number of entries shown, filter by date, or search by message:
git stash list --3 # show last 3 entries
git stash list --before 10.days.ago
git stash list --grep "login"
To inspect what's actually in a stash entry before applying it, use git stash show:
git stash show stash@{2} # summary of changed files
git stash show -p stash@{2} # full diff
git diff stash@{1} main # compare stash against a branch
No Command Line Needed
Managing Stashes in Tower
If you are using the Tower Git client, you can manage all your stash entries and inspect their diffs from the "Stashes" view in the sidebar:

Does git stash Include Untracked Files?
By default, git stash only saves changes to tracked files. New files that haven't been added to Git yet (untracked files) are left behind.
To include untracked files, use the -u flag:
git stash -u
To also stash ignored files (e.g. build artifacts), use -a:
git stash --all
Autostash limitation: The --autostash option used with git pull or git rebase runs a plain git stash internally — it does NOT include untracked files. If you have untracked files that conflict, stash them manually first:
git stash -u
git pull --rebase
git stash pop
Stashing Specific Files
To stash only certain files, pass their paths after --:
git stash push -m "just the CSS" -- css/styles.css
git stash push -- file1.js file2.js
For interactive control over which changes to stash, use --patch:
git stash push --patch
Troubleshooting: "No Local Changes to Save"
If git stash reports no changes to save, one of two things is likely happening:
1. You only have untracked (new) files. A plain git stash ignores them. Use -u:
git stash -u
2. Your changes are in ignored files. Files listed in .gitignore are also skipped by default. Use -a:
git stash --all
No Command Line Needed
Using the Stash in Tower
In case you are using the Tower Git client, saving to and restoring from the Stash can be performed right from the toolbar. Tower even lets you restore the exact state of your Working Copy when you restore a Stash:
Learn More
- Check out the chapter Saving Changes Temporarily – Desktop GUI edition in our free online book