Because I keep forgetting that I originally put this on the twitters…
git log --patch -m -G regexForMissingCode
(Neither of those short options have long names…)
This flag makes the merge commits show the full diff like regular commits; for each merge parent, a separate log entry and diff is generated. An exception is that only diff against the first parent is shown when
--first-parentoption is given; in that case, the output represents the changes the merge brought into the then-current branch.
Look for differences whose patch text contains added/removed lines that match
<regex>. To illustrate the difference between
-G<regex>, consider a commit with the following diff in the same file:+ return !regexec(regexp, two->ptr, 1, ®match, 0); ... - hit = !regexec(regexp, mf2.ptr, 1, ®match, 0);
git log -G"regexec\(regexp"will show this commit,
git log -S"regexec\(regexp" --pickaxe-regexwill not (because the number of occurrences of that string did not change). See the pickaxe entry in
gitdiffcore(7)for more information.
If you find that you’re digging through third-party code or compiled stuff, here’s a handy way of excluding certain directories!