Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# python 2
# git fsck --full
import subprocess
hashes=["01b6a7f272375bc99d98be0068c273b5bc4e9ff6",
"03620d7b53c8a48314c25a3ecdbe369553b01340","PUTYOUR HASHEZ HERE"]
for myhash in hashes:
print "HASH", myhash
bashCommand = "git cat-file -p "+ myhash
process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
file = open("recover/"+myhash, "w")
file.write(output)
file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment