cybre.space has reached the end-of-life and is now read-only. Please see the EOL announcement for details

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

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

the mastodon instance at cybre.space is retired

see the end-of-life plan for details: https://cybre.space/~chr/cybre-space-eol