I popped a stash and there was a merge conflict. Unlike the question that is listed as a duplicate, I already had some uncommitted changes in the directory which I wanted to keep. I don't just want to make the merge conflict disappear, but also to get my directory back to the state it was before the pop.
I tried git merge --abort
, but git claimed no merge was in progress. Is there an easy way to abort a pop without destroying the changes I originally had in the directory?
You can use git reset to unstage your changes if you like. Given that your original git stash apply failed I assume the reverse might also fail since some of the things it wants to undo did not get done.
To pop Git stashes, simply use the “git stash pop” command and specify the stash index you want to pop. See the difference in the last line of the example? The stash was dropped and removed from the stack.
My use case: just tried popping onto the wrong branch and got conflicts. All I need is to undo the pop but keep it in the stash list so I can pop it out on the correct branch. I did this:
git reset HEAD --hard git checkout my_correct_branch git stash pop
Easy.
I have always used
git reset --merge
I can't remember it ever failing.
Note: git reset --merge
will discard any staged changes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With