From: Mike Hommey <mh@glandium.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Francis Moreau <francis.moro@gmail.com>,
Shawn Bohrer <shawn.bohrer@gmail.com>,
git@vger.kernel.org
Subject: Re: Confusion about diffing branches
Date: Mon, 27 Aug 2007 19:24:52 +0200 [thread overview]
Message-ID: <20070827172452.GA10041@glandium.org> (raw)
In-Reply-To: <7vr6lozz3m.fsf@gitster.siamese.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 754 bytes --]
On Mon, Aug 27, 2007 at 10:06:21AM -0700, Junio C Hamano <gitster@pobox.com> wrote:
> Mike Hommey <mh@glandium.org> writes:
>
> > On Mon, Aug 27, 2007 at 03:21:32PM +0200, Francis Moreau <francis.moro@gmail.com> wrote:
> >>
> >> This "inconsistency" had already been raised before. Please refer to:
> >> http://www.gelato.unsw.edu.au/archives/git/0612/35354.html
> >>
> >> I shared and still share your feeling about that but it seems that
> >> Junio and Linus don't...
> >
> > Actually, they may have a good point, cf. the thread you point.
> > But it is annoying that it is not documented.
>
> Would something like this reduce the annoyance factor?
I was actually working on the attached diff, though I'm not really
convinced by my wording.
Mike
[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 2192 bytes --]
Documentation/git-diff.txt | 32 ++++++++++++++++++++++++++++++--
1 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
index b36e705..082ac0b 100644
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -43,9 +43,22 @@ tree and the index file, or the index file and the working tree.
branch.
'git-diff' [--options] <commit> <commit> [--] [<path>...]::
+'git-diff' [--options] <commit>..<commit> [--] [<path>...]::
- This form is to view the changes between two <commit>,
- for example, tips of two branches.
+ These forms are to view the changes between two <commit>,
+ for example, tips of two branches. In the second form,
+ omitting any one of both <commit> will have the same effect
+ as using HEAD.
+
+'git-diff' [--options] <commit>...<commit> [--] [<path>...]::
+
+ This form is to view the changes on the branch containing
+ and up to the second <commit>, starting at a common ancestor
+ of both <commit>.
+ "git-diff A...B" is equivalent to
+ "git-diff `git-merge-base A B` B"
+ You can omit any one of both <commit>, which has the same
+ effect as using HEAD.
Just in case if you are doing something exotic, it should be
noted that all of the <commit> in the above description can be
@@ -54,6 +67,9 @@ any <tree-ish>.
For a more complete list of ways to spell <commit>, see
"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
+Be careful that despite looking like so, both "<commit>..<commit>"
+and "<commit>...<commit>" forms are NOT ranges as described in
+the "SPECIFYING RANGES" section in gitlink:git-rev-parse[1].
OPTIONS
-------
@@ -97,6 +113,18 @@ the tip of the current branch, but limit the comparison to the
file "test".
<3> Compare the version before the last commit and the last commit.
+Comparing branches::
++
+------------
+$ git diff topic master <1>
+$ git diff topic..master <2>
+$ git diff topic...master <2>
+------------
++
+<1> Changes between the tips of the topic and the master branches.
+<2> Same as <1>
+<3> Changes that occured on the master branch since when the topic
+branch was started off it.
Limiting the diff output::
+
next prev parent reply other threads:[~2007-08-27 17:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-26 23:35 Confusion about diffing branches Shawn Bohrer
2007-08-27 0:18 ` Junio C Hamano
2007-08-27 1:40 ` Shawn Bohrer
2007-08-27 6:25 ` Mike Hommey
2007-08-27 7:07 ` Junio C Hamano
2007-08-27 7:50 ` Mike Hommey
2007-08-27 13:21 ` Francis Moreau
2007-08-27 13:33 ` Mike Hommey
2007-08-27 17:06 ` Junio C Hamano
2007-08-27 17:24 ` Mike Hommey [this message]
2007-08-27 17:05 ` Theodore Tso
2007-08-27 17:20 ` Junio C Hamano
2007-08-27 20:29 ` Theodore Tso
2007-08-27 22:20 ` Jakub Narebski
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070827172452.GA10041@glandium.org \
--to=mh@glandium.org \
--cc=francis.moro@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=shawn.bohrer@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.
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 NNTP newsgroup(s).