From: Michael J Gruber <git@drmicha.warpmail.net>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Jacob Keller <jacob.keller@gmail.com>
Subject: [PATCH] Documentation/git-diff: document git diff with 3+ commits
Date: Wed, 26 Oct 2016 11:11:14 +0200 [thread overview]
Message-ID: <07712c2c94670ca4d91ef78cd7d3602a8d36b0c1.1477472970.git.git@drmicha.warpmail.net> (raw)
In-Reply-To: <CA+P7+xq1i8AtQ7i=1m_n9HTSL10kFUFBn8jvNcB_t_6Rh29u4w@mail.gmail.com>
That one is difficult to discover but super useful, so document it:
Specifying 3 or more commits makes git diff switch to combined diff.
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
Notes:
Note that we have the following now:
'git diff A B' displays 'B minus A'
'git diff A B C' displays 'A minus B' and 'A minus C'
While I know why, that (the implicit '-R' seems unfortunate).
(NB: One has to use '-c' if A is an actual merge commiti, it seems.)
If M is a merge base for A and B, we have:
'git diff A..B' equivalent to 'git diff A B'
in contrast to 'git log A..B' listing commits between M and B only
(without the commits between M and A unless they are "in" B).
I would expect 'git diff M B' here.
'git diff A...B' is equivalent to 'git diff M B'
in contrast to 'git log A...B' listing commits between M and A (marked left)
as well as commits between M and B (marked right).
I would expect 'git diff -c -R M A B' here.
Somehow the positive and negative ends of these ranges don't correspond well
with thinking about diffs as differences between these ends.
[I'm not exact with my use of "between" regarding boundary commits.]
Documentation/git-diff.txt | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
index bbab35fcaf..2047318a27 100644
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -12,6 +12,7 @@ SYNOPSIS
'git diff' [options] [<commit>] [--] [<path>...]
'git diff' [options] --cached [<commit>] [--] [<path>...]
'git diff' [options] <commit> <commit> [--] [<path>...]
+'git diff' [options] <commit> <commit> <commit> [<commit>...]
'git diff' [options] <blob> <blob>
'git diff' [options] [--no-index] [--] <path> <path>
@@ -75,9 +76,16 @@ two blob objects, or changes between two files on disk.
"git diff $(git-merge-base A B) B". You can omit any one
of <commit>, which has the same effect as using HEAD instead.
+'git diff' [options] <commit> <commit> <commit> [<commit>...]::
+
+ This is to view a combined diff between the first <commit>
+ and the remaining ones, just like viewing a combined diff
+ for a merge commit (see below) where the first <commit>
+ is the merge commit and the remaining ones are the parents.
+
Just in case if you are doing something exotic, it should be
noted that all of the <commit> in the above description, except
-in the last two forms that use ".." notations, can be any
+in the two forms that use ".." notations, can be any
<tree>.
For a more complete list of ways to spell <commit>, see
--
2.10.1.723.g0f00470
next prev parent reply other threads:[~2016-10-26 9:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-21 21:40 generating combined diff without an existing merge commit Jacob Keller
2016-10-21 22:01 ` Jacob Keller
2016-10-21 22:41 ` Junio C Hamano
2016-10-21 22:54 ` Jacob Keller
2016-10-26 9:11 ` Michael J Gruber [this message]
2016-10-26 18:11 ` [PATCH] Documentation/git-diff: document git diff with 3+ commits Junio C Hamano
2016-10-27 9:27 ` Michael J Gruber
2016-10-27 18:40 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=07712c2c94670ca4d91ef78cd7d3602a8d36b0c1.1477472970.git.git@drmicha.warpmail.net \
--to=git@drmicha.warpmail.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.keller@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).