Skip to content

Instantly share code, notes, and snippets.

@Shipu
Created December 9, 2020 10:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shipu/a601f100ab7d24883e345717be219d38 to your computer and use it in GitHub Desktop.
Save Shipu/a601f100ab7d24883e345717be219d38 to your computer and use it in GitHub Desktop.
# 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