]> git.ipfire.org Git - thirdparty/git.git/commitdiff
doc/git-log: clarify handling of merge commit diffs
authorJeff King <peff@peff.net>
Wed, 29 Jul 2020 20:12:20 +0000 (16:12 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 29 Jul 2020 20:44:03 +0000 (13:44 -0700)
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-log.txt

index 0a4c99e5f83b2f9a26b294b27db85bd7cf577166..9ccba65469d7c6bc42fc8fb2de6fef36b1969061 100644 (file)
@@ -117,6 +117,13 @@ DIFF FORMATTING
 By default, `git log` does not generate any diff output. The options
 below can be used to show the changes made by each commit.
 
+Note that unless one of `-c`, `--cc`, or `-m` is given, merge commits
+will never show a diff, even if a diff format like `--patch` is
+selected, nor will they match search options like `-S`. The exception is
+when `--first-parent` is in use, in which merges are treated like normal
+single-parent commits (this can be overridden by providing a
+combined-diff option or with `--no-diff-merges`).
+
 -c::
        With this option, diff output for a merge commit
        shows the differences from each of the parents to the merge result