git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Confusion about diffing branches

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 27, 2007, 17:06 UTC
Message-ID
<7vr6lozz3m.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20070827133314.GA9131@glandium.org>
Mike Hommey <mh@glandium.org> writes:
Show 10 quoted lines
> 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?
---
 Documentation/git-diff.txt |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
index b36e705..04b62d9 100644
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -42,14 +42,28 @@ tree and the index file, or the index file and the working tree.
 	branch name to compare with the tip of a different
 	branch.
 
-'git-diff' [--options] <commit> <commit> [--] [<path>...]::
+'git-diff' [--options] <commit1> <commit2> [--] [<path>...]::
 
 	This form is to view the changes between two <commit>,
 	for example, tips of two branches.
 
+'git-diff' [--options] <commit1>..<commit2> [--] [<path>...]::
+
+	This is identical to the previous one, just to make the
+	specification of two commits look similar to a commit
+	range notation.
+
+'git-diff' [--options] <commit1>...<commit2> [--] [<path>...]::
+
+	This compares the merge base of two commits and the
+	second commit.  Useful to view what happened in the
+	history that leads to the second commit since that
+	history forked from the history that leads to the first
+	commit.
+
 Just in case if you are doing something exotic, it should be
-noted that all of the <commit> in the above description can be
-any <tree-ish>.
+noted that all of the <commit> in the above description,
+except for the last two variants, can be any <tree-ish>.
 
 For a more complete list of ways to spell <commit>, see
 "SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
Previous: Mike HommeyNext: Mike Hommey
Message 9 of 14 in “Confusion about diffing branches”
  1. Shawn BohrerAug 26, 2007
  2. Junio C HamanoAug 27, 2007
  3. Shawn BohrerAug 27, 2007
  4. Mike HommeyAug 27, 2007
  5. Junio C HamanoAug 27, 2007
  6. Mike HommeyAug 27, 2007
  7. Francis MoreauAug 27, 2007
  8. Mike HommeyAug 27, 2007
  9. Junio C HamanoAug 27, 2007
  10. Mike HommeyAug 27, 2007
  11. Theodore TsoAug 27, 2007
  12. Junio C HamanoAug 27, 2007
  13. Theodore TsoAug 27, 2007
  14. Jakub NarebskiAug 27, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.