Last Updated: February 25, 2016
·
625
· benben

clean changes from accidently git stash pop

If you accidently do a $ git stash pop and you do want to throw away the changes made by this, but keep all uncommitted changes, do this:

You should have the stash sha from your pop command:

Dropped refs/stash@{0} (415b859aacd665d2c3988c3538ac003e1f371d79)

Now you can do

$ git diff 415b859aacd665d2c3988c3538ac003e1f371d79^! | patch -p1 -R

to remove those changes.