Friday, October 24, 2014

Recover lost data from git hard reset

Big thanks to this excellent post I used to restore a ton of "lost" data when I accidentally did a git hard reset back to an old commit: http://www.programblings.com/2008/06/07/the-illustrated-guide-to-recovering-lost-commits-with-git/

My takeaway steps to recovering data:

coty$ git fsck --lost-found
Checking object directories: 100% (256/256), done.
Checking objects: 100% (17780/17780), done.
dangling commit b7c3533a8219f99ff4dd7402372dcea9ce114644
coty$ git show b7c3533a8219f99ff4dd7402372dcea9ce114644
coty$ git stash save "before rebase to recover data"
coty$ git rebase b7c3533a8219f99ff4dd7402372dcea9ce114644

No comments: