Reputation: 8287
This seems very foolish mistake, I just did a git stash pop
on a dirty working tree. I do not know any way of keeping the desired changes and undoing the stash pop
. Does one exist? Or such a mistake is unforgivable?
Upvotes: 16
Views: 4494
Reputation: 16044
If you still have that stash's SHA1, you can generate a patch from it (git format-patch SHA1
) and apply the patch in reverse (git apply -R filename.patch
).
If you lost the SHA1, see How to recover a dropped stash in Git?
Upvotes: 10
Reputation: 478
git stash pop
does 2 things: git stash apply
and git stash drop
. If you can undo the drop
, using this question and answers, then you'd just have to undo the apply
. I'm not sure how to do this, but you might look into . but adl does.git rebase
Upvotes: 1