Drilling down into “git log -G”
When you run git log -G <some pattern> -i, you get a list of refs where this
pattern was found in a change (delete or insert).
A slightly more user-friendly way is to use gitk -G<pattern> -i, but even
then, it doesn’t quite do the job – it always behaves as if --pickaxe-all
was specified.
Here’s fzfm’s take on this:
Type g queryrc when you’re already in git mode, and
hit alt_m, you get the first frame of this GIF:
- The first commit (b89…) has 3 files changed, of which 2 are affected, which is not too bad.
- You can see the diff for a particular file by scrolling to it.
- The next commit (60e…) has 21 files changed, of which only 2 files have a change that includes the pattern you’re interested in. (Also notice the 2752 at top right; this is the full log for the commit. Way too much info when you’re looking for a single pattern!)
- But again, you can scroll to an individual file to see just that file’s diff.
There are a couple of other things you can do here. First of all, each file
you see there, if it still exists in the currently checked out branch, can be
edited, moved, renamed, whatever. More importantly, if you hit tab on a
commit line, then tab on a file under that commit, and then alt-v, you can
see the file as it was at that commit.
I may add more features later, but so far, this is good enough for me. None of the open source TUI tools I looked at would do this. (Among the GUIs, I am told some of the proprietary ones can also do this, but I wouldn’t know about those).