I'm trying to look for unreachable commits that use certain file somefile.jsx
, say. Can I do that? Or can I look for ones that contain a certain specific in one of the files? The deeper problem I have hundreds of unreachable commits there's one I'm looking for ..
git fsck --unreachable --no-progress
to get just the lines with the commit info.grep 'unreachable commit'
.cut -d' ' -f3
to get the commit it (the 3rd field).Putting that all together...
git fsck --unreachable --no-progress | grep 'unreachable commit' | cut -d' ' -f3
Now you have a list of all the unreachable commits. Put that in a file.
You can run git --no-pager log --format=oneline -n1 --stat <commit id>
on each of them to see what files they changed. Here's a little Perl one-liner to do that.
perl -nwle 'system "git --no-pager log --format=oneline -n1 --stat $_"' <commit file>
You can even grep for "WIP" to find old stashes.