git log -S "..."
git log -S "..." --pickaxe-regex
git log -G "..."
git log --grep="..."
See docs for
- git log -S <string> will look for the commits that changes the number of occurrences. This will find when something was added or removed, but not just moved to somewhere else inside the same commit.
- git log -S <regex> --pickaxe-regex Same as above, but with regex support
- git log -G <regex> will look for the commits where a change involves this regex or text. It will find when it has been moved, as well as added or removed.
- git log --grep=<pattern> searches in commit messages only