Only recovering LaTeX files with git fsck

62 Views Asked by At

I accidentally deleted a large number of LaTeX files by using git stash instead of git stash -u. I have recovered a bunch of them following the instructions here using the command:

git fsck --full --no-reflogs --unreachable --lost-found | grep blob | cut -d\  -f3 | while read in; do printf "blob: $in\n"; git cat-file -p $in; printf "\n--------------------------------\n"; done > recover.txt

The problem is this includes a bunch of junk like log files, I would like to modify this command so that I only recover files that include the words "\begin{document}" inside them. It seems like this should be easily doable by modifying the grep step in the code above, but I do not understand the copied code well enough to do this myself.

0

There are 0 best solutions below