git stash blunder: git stash pop and ended up with merge conflicts
Solution 1:
See man git merge (HOW TO RESOLVE CONFLICTS):
After seeing a conflict, you can do two things:
Decide not to merge. The only clean-ups you need are to reset the index file to the HEAD commit to reverse 2. and to clean up working tree changes made by 2. and 3.; git-reset --hard can be used for this.
Resolve the conflicts. Git will mark the conflicts in the working tree. Edit the files into shape and git add them to the index. Use git commit to seal the deal.
And under TRUE MERGE (to see what 2. and 3. refers to):
When it is not obvious how to reconcile the changes, the following happens:
The HEAD pointer stays the same.
The MERGE_HEAD ref is set to point to the other branch head.
Paths that merged cleanly are updated both in the index file and in your working tree.
...
So: use git reset --hard
if you want to remove the stash changes from your working tree, or git reset
if you want to just clean up the index and leave the conflicts in your working tree to merge by hand.
Under man git stash (OPTIONS, pop) you can read in addition:
Applying the state can fail with conflicts; in this case, it is not removed from the stash list. You need to resolve the conflicts by hand and call git stash drop manually afterwards.
Solution 2:
I had a similar thing happen to me. I didn't want to stage the files just yet so I added them with git add
and then just did git reset
. This basically just added and then unstaged my changes but cleared the unmerged paths.