How to Fix git stash pop Conflicts
You ran git stash pop and got a conflict. Now your working tree is a mess and your stash is in an ambiguous state. Here is exactly what happened and how to get out of it cleanly.
What just happened
When git stash pop hits a conflict, it applies the stash as much as it can and leaves conflict markers in the affected files — just like a merge conflict. Critically, the stash entry is NOT removed when a conflict occurs. It stays in the stash list until you manually drop it.
git stash list # confirm stash@{0} is still thereResolve the conflicts normally
Open the conflicting files and resolve the markers:
<<<<<<< Updated upstream
function login() { ... } // current branch version
=======
function login() { ... } // your stashed version
>>>>>>> Stashed changesEdit to keep what you want, then mark each file as resolved:
git add <resolved-file>
git add <other-resolved-file>Do not run git commit here. You are resolving a stash conflict, not completing a merge. Just stage the resolved files.
Drop the stash entry
Since the stash was not automatically removed on conflict, drop it manually once your files are in the state you want:
git stash drop stash@{0} # remove the stash entryThe safer approach: stash apply + manual drop
Next time, prefer git stash apply over git stash pop. They behave identically, except apply never auto-removes the stash — which means you have time to verify the result before deciding to drop:
git stash apply # apply stash, keep it in list
# resolve conflicts, verify output
git stash drop # only drop when you are sureIf the conflict is too messy and you want to start over
git checkout -- . # discard all working tree changes
git stash drop stash@{0} # remove the stash entry you appliedgit checkout -- . discards all uncommitted changes permanently. Only use it if you want to throw away the conflict resolution attempt entirely and go back to a clean working tree.
Inspect stash contents before popping
To avoid surprise conflicts in the first place, preview what a stash contains before applying it:
git stash show -p stash@{0} # full diff of the stash
git stash show --stat stash@{0} # just the changed filesIf the stash touches the same files that have changed on your current branch, expect a conflict. Switch to a clean branch before applying, or resolve proactively.
Git Unfucked covers every variation: conflicting stashes, dropped stash recovery, stash on wrong branch, and partial stash apply — with the exact commands and the context to know when each is safe.
Get Git Unfucked →