On , I learnt ...

About git log -G

git log supports two options for searching the contents of each commit’s patch:

The -G option can be useful to add a word boundary character to a fixed string. So instead of:

$ git log -S my_string

use:

$ git log -G "\<my_string\>"

to avoid unwanted matches (like my_string_with_extra_stuff).

These filtering options are best used with the -p or --patch option to show the commit diff of files that contain the searched-for string/regex. To see the diff of all files in each matching commit, use the --pickaxe-all option too.