Knowledge
git stash pop vs apply: save and restore changes
#Development
git stash shelves your uncommitted changes so you can switch context. git stash pop restores them and removes the stash; git stash apply restores them but keeps the stash around.
Published by Mark van Eijk on June 23, 2026 · 1 minute read
Stashing your changes
git stash takes your modified tracked files, saves them away, and gives you a clean working directory:
git stash
By default it does not include untracked files. Add -u to stash those too:
git stash -u
Give a stash a label so you can recognise it later:
git stash push -m "half-finished login form"
pop vs apply
Both bring your changes back. The difference is what happens to the stash afterwards:
git stash pop # restore the changes AND delete the stash entry
git stash apply # restore the changes but KEEP the stash entry
Use apply when you want to restore the same changes onto more than one branch. Use pop for the normal "I'm back, give me my work" case.
Working with multiple stashes
List what you have stashed:
git stash list
stash@{0}: On main: half-finished login form
stash@{1}: WIP on feature: 3f9a1c2 ...
Apply or pop a specific one by its reference:
git stash apply stash@{1}
git stash pop stash@{1}
Drop a stash you no longer need, or clear them all:
git stash drop stash@{0}
git stash clear
When pop hits a conflict
If your stashed changes conflict with the current state of the files, git stash pop stops with merge conflicts and, importantly, keeps the stash so you do not lose it. Resolve the conflicts, stage the files, then drop the stash manually:
git stash drop
If you would rather permanently discard uncommitted changes than stash them, see git reset --hard.
Subscribe to our newsletter
Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!
Related articles
Install PHP memcached extension on macOS
git stash shelves your uncommitted changes so you can switch context. git stash pop restores them and removes the stash; git stash apply restores them but keeps the stash around.
How to delete a local (and remote) Git branch
git stash shelves your uncommitted changes so you can switch context. git stash pop restores them and removes the stash; git stash apply restores them but keeps the stash around.