Cheat Sheets · Git Cheat Sheet · Git Stash — Park Changes Without Committing
Git Stash — Park Changes Without Committing
git stashPark all tracked-file changes; working tree becomes clean
git stash popBring the latest stash back and remove it from the stack
git stash applyBring it back but keep a copy in the stack
git stash listShow parked stashes (stash@{0} is newest)
git stash drop stash@{1}Delete a specific stash entry
Core stash workflow
| Command | Effect |
|---|---|
git stash | Park all tracked-file changes; working tree becomes clean |
git stash pop | Bring the latest stash back and remove it from the stack |
git stash apply | Bring it back but keep a copy in the stack |
git stash list | Show parked stashes (stash@{0} is newest) |
git stash drop stash@{1} | Delete a specific stash entry |
Useful options
| Command | Effect |
|---|---|
git stash -u | Include untracked files (ignored files need -a) |
git stash push -m "wip: login bug" | Give the stash a memorable name |
git stash pop stash@{2} | Restore a specific (older) stash |
Stash shelves your uncommitted changes and gives you a clean working tree — perfect for "I need to fix something else first".
Related Git recipes
FAQ
Does stash include new (untracked) files?
Not by default — stash only touches tracked files. Add -u to include untracked files, -a to include ignored ones too.
Can I stash on one branch and pop on another?
Yes — a stash is branch-agnostic. Pop it wherever the changes belong; conflicts are resolved like a merge.
Stash or branch?
Stash for minutes-to-hours parking; a real branch for anything that might survive past today. Stashes are easy to forget and painfully easy to drop.
Stop memorizing — build it interactively
Generate stash commands in the Git BuilderFull reference: Git Cheat Sheet