This error occurs when git stash pop or git stash apply tries to reapply stashed changes that conflict with modifications made to your working directory since the stash was created. The conflict must be resolved manually before you can continue.
When you run `git stash pop` or `git stash apply`, Git attempts to merge your stashed changes back into your working directory. If the same lines in a file have been modified both in your stash and in your current working tree (or commits made since stashing), Git cannot automatically determine which version to keep. This results in a merge conflict that must be resolved manually. The `CONFLICT (content)` message indicates a content-level conflict where the same section of a file has diverging changes. Git marks these conflicting sections in the file with conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`) so you can see both versions and decide how to merge them. Importantly, when a conflict occurs during `git stash pop`, the stash is NOT automatically dropped from the stash list. This safety feature allows you to abort the operation and try again if needed.
Run git status to see which files have conflicts:
git statusFiles with conflicts will be listed under "Unmerged paths" or shown as "both modified".
Open each conflicting file in your editor. Look for conflict markers:
<<<<<<< Updated upstream
// Current working tree changes
=======
// Stashed changes
>>>>>>> Stashed changesDecide which changes to keep, edit the file to your desired state, and remove all conflict markers. You can keep one version, the other, or combine them.
After editing, stage the resolved files:
git add <resolved-file>
# Or stage all resolved files:
git add .If you want to unstage and keep working without committing:
git restore --staged .Since the stash was not automatically dropped due to the conflict, remove it manually after successful resolution:
git stash dropThis removes the most recent stash entry. If you applied a specific stash, use git stash drop stash@{n} where n is the stash index.
If you want to undo the stash pop and start over:
# Reset all changes (WARNING: discards uncommitted work)
git checkout -f
# Or for specific files:
git checkout -- <file>The stash remains intact so you can try a different approach.
Using git stash apply vs pop: Consider using git stash apply instead of git stash pop. The apply command keeps the stash regardless of success, giving you a safety net. You can manually drop it with git stash drop after confirming everything works.
Merge tools: For complex conflicts, use a visual merge tool:
git mergetoolThis opens your configured merge tool (like vimdiff, meld, or VS Code) to help resolve conflicts visually.
Stashing to a branch: If you frequently encounter stash conflicts, consider creating a branch from your stash instead:
git stash branch <new-branch-name>This creates a new branch from the commit where you originally stashed, applies the stash, and drops it if successful.
Partial stash application: Use git checkout stash -- <file> to selectively apply specific files from a stash without triggering a full merge.
ssh: Could not resolve hostname github.com: Name or service not known
How to fix 'ssh: Could not resolve hostname github.com: Name or service not known' in Git
error: insufficient permission for adding an object to repository database .git/objects
How to fix "insufficient permission for adding an object to repository database" in Git
fatal: could not create work tree dir 'repo': Permission denied
How to fix "could not create work tree dir: Permission denied" in Git
Smudge error: Error downloading object: The requested URL returned error
How to fix Git LFS 'Smudge error: Error downloading object' error
fetch-pack: unexpected disconnect while reading sideband packet
How to fix 'unexpected disconnect while reading sideband packet' in Git