undo a dropped git stash
let us say we drop a stash accedently
and now we want to recover it
we can:
- see the
dangling
git stashes ie. code which is unreachable
git fsck --unreachable | grep commit | cut -d ' ' -f3 | xargs git show
- take a sha and create a patch
assume SHA
is 3202c4c4cb1e14b43954fb6f1d24552bc45e86bf
git format-patch --stdout head..3202c4c4cb1e14b43954fb6f1d24552bc45e86bf > /tmp/patch
git apply --stat /tmp/patch
git apply --check /tmp/patch
git am /tmp/patch
git commit --amend to edit commit message
googled when faced with this problem now
https://github.com/abhikp/git-test/wiki/Recovering-a-lost-stash helped