Search git history for a change in a merge commit
To search for a string that has been added/removed in git history I can do
git log -S'some text'
This works great except that it doesn't search through merge commits. 开发者_Go百科How do I get the command to include merge commits in the search?
it appears that the -m flag gives me the desired result
git log -m -S'some text'
I found this on another site, if someone could point me in the direction of a man page that includes this flag that would be great. This one doesn't include it http://ftp.kernel.org/pub/software/scm/git/docs/git-log.html
Since some Git commands are built on top of other ("plumbing") commands they often inherit options from other commands. I agree that it's annoying not to see those documented in the man pages or in the --help
output. In this case, the git-log help states:
The command takes options applicable to the git-rev-list command to control what is shown and how, and options applicable to the git-diff-* commands to control how the changes each commit introduces are shown.
In this case, you'll find the -m
option under git-diff-tree:
... -m By default, git-diff-tree --stdin does not show differences for merge commits. With this flag, it shows differences to that commit from all of its parents. See also -c. ...
精彩评论