Showing posts with label recover lost file. Show all posts
Showing posts with label recover lost file. Show all posts

Thursday, July 14, 2016

Recovering staged lost files during git reset --hard

$ git fsck --cache --unreachable $(git for-each-ref --format="%(objectname)")   $(egrep commit all | cut -d ' ' -f 3)
Checking object directories: 100% (256/256), done.
Checking objects: 100% (542/542), done.
unreachable blob 6900c6418b5df26f6471b7d4853822d99fcf2534
unreachable blob 945019391229d1304b47c7d1dc112ff45bbca360
unreachable blob 0ed3acde384de116f4b194bfd226055074a9f52d
unreachable blob c0234fc886423ff40a96b4c3e7ba67a4deb944c0
unreachable blob c9754aed2e981cdf678159ab41f7bfea89c93cbd
unreachable blob 8168f4a5a91997641211ce0d30b01e8bf8920792
unreachable blob 8c9cc9beddbc89a0ef46a1631265f79551a78e8a

unreachable blob 758e9c59bc04d38bd676c3c98e6d092b698defa4


Your file should be one of those unreachable blob from the above list. To verify that, do git show for every blob and see.

$ git show 6900c6418b5df26f6471b7d4853822d99fcf2534



Resources: