Created
September 27, 2013 21:54
-
-
Save a2ndrade/6735774 to your computer and use it in GitHub Desktop.
Git: Trying to recover a lost file version (after performing destructive changes e.g. rebasing, squashing, amending, etc)
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
# create dir to put all file version found | |
mkdir target && cd target | |
# checkout all "lost" commits and save a file version for each of them | |
for i in `git reflog | head -75 | awk '{print $1}'`; do cat path_to_file > `git log -1 | head -1 | awk '{print $2}'`; done | |
# use fdupes to find duplicates, etc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment