loading...
Cover image for Recover Lost Deleted “Git stash” using “Git fsck”

Recover Lost Deleted “Git stash” using “Git fsck”

egitsptr profile image Egit S. Originally published at esabook.wordpress.com on ・1 min read

1- Open Repository Directory in Terminal / Git Bash.

git fsck | awk ‘{print $3}’ > ids.txt
cat ids.txt | xargs git show > logs.txt

2- Then open ​logs.txt, and find deleted stash id.

example:  
commit a31b0a30701933cfb3d8a55cd4b96320865ae558  
Merge: c465de7 57a3521  
Author: Egit Saputra \  
Date: Tue Feb 19 14:37:29 2019 +0900  
On development: deleted stash test

3- and recover with git stash apply to current active branch.

git stash apply a31b0a30701933cfb3d8a55cd4b96320865ae558

Discussion

pic
Editor guide