`git log -S some_variable_name` returns all commits where `some_variable_name` is in the diff (either removed, added, or modified)
super useful for tracking down regressions where you know the variable that's the culprit
| Pronouns | He/him |
| [email protected] | |
| Games | http://www.draknek.org |
@darius Yes! One of my faves, which means I've been bitten by an important nuance:
-S will not find diffs that only *modify* lines involving that variable, because it shows diffs that "change the number of occurrences of the specified string".
If you want to find those cases, you want `git log -G` instead, since it returns "differences whose patch text contains added/removed lines that match".
Heads up that -G takes a regex vs -S taking a substring (altho you can make -S regex with --pickaxe-regex). Fortunately they're right next to each other in `git help log`, which actually has a nice little example showing the difference between the two as well.
`git log -S some_variable_name` returns all commits where `some_variable_name` is in the diff (either removed, added, or modified)
super useful for tracking down regressions where you know the variable that's the culprit