Rob Rob - 1 year ago 145
Git Question

Case-insensitive git pickaxe search

I'm trying to find all commits where a particular string or arbitrary capitalisation thereof (e.g.

) was introduced/removed in a git repository.

Based on this SO answer (which covers a different basic use case), I first tried using
git grep

git rev-list --all | xargs git grep -i foobar

This was pretty awful, as it only gave information as to whether the string is present in a commit, so I ended up with loads of superfluous commits.

I then tried
, which got me most of the way there, e.g.

git log --pickaxe-regex -S'foobar' --oneline

This only got the lowercase
. I tried the
flag, but that doesn't seem to apply to the
option. I then resorted to using patterns like this, which got me a bit further:

git log --pickaxe-regex -S'' --oneline

Needless to say, that's not ideal.

Is there a way to make
do case-insensitive matching?


Answer Source

The way the -i is used with pickaxe (see commit accccde, git 1.7.10, April 2012) is:

 git log -S foobar -i --oneline
 # or
 git log --regexp-ignore-case -Spicked
 # or
 git log -i -Spicked

Note that this option would not work fix a regexp, only with a fixed string.
It works with regexp only since git 2.0 and commit 218c45a, git 2.0, May 2014.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download