Discard Git Stash Pop

git

Solution

This has already been asked and answered on stackoverflow (see How to revert Git repository to a previous commit?), but the simple answer is:

git reset --hard HEAD

This should take care of your problem. Note that this removes all uncommitted changes from the repository.

Note that if there are conflicts, the stash is preserved. From the stash docs:

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.

Problem

I did a git stash pop and now I have a ton of conflicts. I had committed all my recent code before the `git stash pop`, so is there a way to go back to the last commit and get rid of all the conflicts and code the `git stash pop` injected?

Original source

Related problems