git pro tip 

`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

Follow

git pro tip 

@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.

Sign in to participate in the conversation
Cybrespace

cybrespace: the social hub of the information superhighway jack in to the mastodon fediverse today and surf the dataflow through our cybrepunk, slightly glitchy web portal support us on patreon or liberapay!