Skip to content

Commit 5fbb4bc

Browse files
peffgitster
authored andcommitted
doc/git-log: clarify handling of merge commit diffs
It can be surprising that git-log doesn't show any diff for merge commits by default. Arguably "--cc" would be a reasonable default, but it's very expensive (which is why we turn it on for "git show" but not for "git log"). Let's at least document the current behavior, including the recent "--first-parent implies -m" case Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9a6d515 commit 5fbb4bc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Documentation/git-log.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,13 @@ DIFF FORMATTING
117117
By default, `git log` does not generate any diff output. The options
118118
below can be used to show the changes made by each commit.
119119

120+
Note that unless one of `-c`, `--cc`, or `-m` is given, merge commits
121+
will never show a diff, even if a diff format like `--patch` is
122+
selected, nor will they match search options like `-S`. The exception is
123+
when `--first-parent` is in use, in which merges are treated like normal
124+
single-parent commits (this can be overridden by providing a
125+
combined-diff option or with `--no-diff-merges`).
126+
120127
-c::
121128
With this option, diff output for a merge commit
122129
shows the differences from each of the parents to the merge result

0 commit comments

Comments
 (0)