git log -G 'password\s*=' --oneline

Category: Git - Core

git log -G 'password\s*=' --oneline

Find commits whose diff matches a regex

The -G option lists commits whose patch adds or removes a line matching the regular expression. Unlike -S it matches line content rather than count changes, so it finds every touched line. Quote the pattern so the shell does not interpret it.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.