Skip to content

Instantly share code, notes, and snippets.

View kazmiali's full-sized avatar
:electron:
Focusing

Muhammad Ali Kazmi kazmiali

:electron:
Focusing
View GitHub Profile
@kazmiali
kazmiali / stash-pop-recover
Created January 18, 2022 22:08 — forked from davidwalter0/stash-pop-recover
Undoing accidental git stash pop
# https://stackoverflow.com/questions/6543519/undoing-accidental-git-stash-pop
# https://stackoverflow.com/questions/89332/how-to-recover-a-dropped-stash-in-git
accepted
If you have only just popped it and the terminal is still open, you will still have the hash value printed by git stash pop on screen (thanks, Dolda).
Otherwise, you can find it using this for Linux and Unix:
git fsck --no-reflog | awk '/dangling commit/ {print $3}'
and for Windows: