I want to view a git log
of commits that obey all of the following:
- The commit modifies a file whose name matches a given pattern.
- The commit changes the number of occurrences of a pattern in a file (essentially, what
--pickaxe-regex -S
does). - The change matching rule 2 does not necessarily occur in the file matching rule 1.
Basically, I want to combine Show all commits whose diff contain specific string and Find commits that modify file names matching a pattern in a GIT repository. Just combining those two techniques, as I've done below, satisfies rules 1 & 2, but not 3.
So far I have:
git log --pickaxe-regex -S 'ChangePattern|SomeAlternatePattern' -- '*/filename.txt'
This works as long as the change occurs in filename.txt
; however, the change I am looking for is in a different file than the one that is being matched by the pattern.