DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,274 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Recover Lost Deleted β€œGit stash” using β€œGit fsck”
Egit S.
Egit S.

Posted on • Originally published at esabook.wordpress.com on

Recover Lost Deleted β€œGit stash” using β€œGit fsck”

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

Top comments (0)

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. πŸ›