Friday, February 2, 2018

Recover accidentally deleted Git Stash

Step to recover the accidentally deleted Git Stash:

1. Get the list of unreachable commits, the accidentally deleted commit might still there before garbage collected.
git fsck --unreachable 

 2. Check through the list of unreachable commits -- <sha> begin with "unreachable commit", ignore the <sha> begin with "unreachable blob".
git show  <sha>

3. Once find the accidentally deleted commit, recover the commit.
git stash apply <sha>


Real Time Web Analytics