Last active
December 15, 2022 22:39
-
-
Save ivanfretes/815238f5a8ee408f2ff2eb9eb30a2de3 to your computer and use it in GitHub Desktop.
Recovery commits, tree and blob with bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| mkdir recovery-git | |
| filehashes='recovery-git/00_hashes.txt' | |
| rm $filehashes | |
| git fsck --unreachable >> $filehashes | |
| while read line; do | |
| wordsInLine=($line) | |
| hash=${wordsInLine[2]} | |
| echo $hash | |
| git show $hash >> "recovery-git/$hash.txt" | |
| echo "-----------------------------------------------------------------" | |
| done < $filehashes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment