Recover a dropped stash
Ok sometime you're a little bit tired and instead of making a git stash pop [ref]
you make a git stash drop [ref]
.
Keep calm, and keep reading
So how to recover a dropped stash ?
-
First of all we launch gitk to get a repo browser and tell them to show every single commit in the repository. ever. regardless of whether it is reachable or not :
gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
Right now just browse your code and find the SHA1
Quit gitk and use
git stash apply [SHA1]
and breathe
Written by Thibault Milan
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git stash
Authors
clawfire
2.988K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#