Last active
September 15, 2016 14:06
-
-
Save jleehr/b5faf8e0376eb20e4e77a9195a81ab29 to your computer and use it in GitHub Desktop.
Restore lost files in git
This file contains 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
#!/bin/bash | |
# 1. git fsck --lost-found | |
# 2. run this script via bash restore.php | |
cd PATH_TO/.git/lost-found/other | |
FILES=* | |
COUNTER=0 | |
for f in $FILES; do | |
echo "Processing $f file..." | |
git show $f > "PATH_TO/recover/$COUNTER.txt" | |
let COUNTER=COUNTER+1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment