I'd like to git grep
in the usual way, but with something like the additional insight of git blame
in the displayed results.
In some instances I probably would benefit from including the metadata in the search query (show only results written by Bob), and in others I'd rather just use my own human judgement. I guess I'm flexible with which way that goes.
I added the following to my git aliases:
Which I shamelessly stole and adapted from: https://gist.github.com/lonnen/3101795
I added the pathspec argument so it’s used as:
Note that git blame is called for each match. Since
git blame
can be quite long, if a file has several match, the repeated call can be quite costly. Better try something like:but which still does 2
git grep
call instead of one. Some awk/sed/perl invocation could format the first invocation ofgit grep
as: