I found in another answer that I can list the files changed in a commit with:
git diff-tree --no-commit-id --name-only -r bd61ad98
How can I then to show only the files which include a specific text change in the diff?
I found in another answer that I can list the files changed in a commit with:
git diff-tree --no-commit-id --name-only -r bd61ad98
How can I then to show only the files which include a specific text change in the diff?
You can use the -G flag:
-G<regex>Look for differences whose patch text contains added/removed lines that match .
To illustrate the difference between
-S<regex> --pickaxe-regexand-G<regex>, consider a commit with the following diff in the same file:+ return !regexec(regexp, two->ptr, 1, ®match, 0); ... - hit = !regexec(regexp, mf2.ptr, 1, ®match, 0);While
git log -G"regexec\(regexp"will show this commit,git log -S"regexec\(regexp" --pickaxe-regexwill not (because the number of occurrences of that string did not change).See the pickaxe entry in gitdiffcore[7] for more information.
For example:
git diff-tree --no-commit-id -G<regex with what you are looking at> --name-only -r bd61ad98