How to resolve git stash conflict without commit?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
git stash is useful because it lets you shelve local changes without making a commit, but conflicts can appear when you reapply the stash onto a changed working tree. The good news is that you do not need to create a commit just to finish resolving the conflict and keep working.
What a Stash Conflict Actually Means
A stash is basically a recorded patch plus metadata about the state of your worktree. When you run git stash apply or git stash pop, Git tries to merge those saved changes back into your current files.
If the same lines were edited in both places, Git cannot decide which version should win. That is the same core problem as a merge conflict, except the source of one side is the stashed change instead of another branch.
The Normal Resolution Flow
Start by checking the current status:
You will see conflicted files listed as unmerged. Open those files and look for conflict markers such as:
Edit the file so it contains the final content you actually want, then remove the conflict markers.
After each file is fixed, stage it:
That marks the conflict as resolved. Staging is enough. You do not have to commit unless you actually want a commit for your workflow.
apply Versus pop
The difference matters during cleanup:
- '
git stash applyreapplies the stash but keeps the stash entry' - '
git stash popreapplies the stash and tries to drop the stash entry afterward'
When pop hits conflicts, Git usually keeps the stash entry because the apply step did not finish cleanly. That is helpful, because you can retry or inspect it again if needed.
A careful workflow is:
Resolve the conflicts, stage the files, and only drop the stash when you are satisfied:
This is safer than using pop when you already expect a messy reapply.
Keeping the Resolution Without Committing
Once all conflicted files are edited and staged, your stash conflict is resolved from Git's point of view. At that stage you can:
- keep working and make more edits
- unstage files if you want them back in the regular working tree
- commit later when it makes sense
For example:
If you want the files resolved but not staged, unstage them after the conflict is cleared:
That leaves the resolved content in your working tree without creating a commit.
Useful Conflict Helpers
If you want to accept one side wholesale for a file, Git provides shortcuts. On many Git versions, these are easier to reason about than manual editing for simple cases:
Then stage the chosen file:
You should still inspect the result carefully. In a stash conflict, "ours" and "theirs" refer to merge sides, not necessarily the labels you would intuitively guess from the stash command alone.
If You Want to Abort Instead
Sometimes the best answer is to back out and try again on a cleaner branch. If you used git stash apply and have not gone far, you can discard the conflicted worktree changes and start over on a safer base.
A lower-risk operational habit is:
- use
git stash applyinstead ofpop - inspect conflicts
- resolve or abandon
- drop the stash only after success
That pattern gives you a recovery path without forcing a commit.
Common Pitfalls
- Thinking
git addmeans you are forced to commit immediately, when it only marks the conflict as resolved. - Using
git stash popby default even whenapplywould give you a safer retry path. - Forgetting to remove conflict markers before staging the file.
- Dropping the stash entry before you verify that the resolved working tree is actually correct.
- Choosing
--oursor--theirswithout inspecting which side contains the content you want.
Summary
- A stash conflict is resolved like any other Git merge conflict: edit, then stage the file
- You do not need to make a commit just to finish the stash resolution
- '
git addmarks a file as resolved; it does not force an immediate commit' - '
git stash applyis often safer thangit stash popwhen conflicts are possible' - After resolving, you can keep working, unstage files, and commit later on your own schedule

