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

Re: Incorrect man page for git-diff

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 18, 2012, 19:32 UTC
Message-ID
<7vehinf95i.fsf@alter.siamese.dyndns.org>
In-Reply-To
<50D0BF8D.5050004@gmail.com>
Manlio Perillo <manlio.perillo@gmail.com> writes:
> I'm not sure the man page is wrong and should be changed:
>
>   -- usage: git diff [<options>] [<commit> [<commit>]] [--] [<path>...]
>   ++ usage: git diff [<options>] [<commit> [<commit>]]

Comparison of two blob objects works entirely in different way (it is not even recursively comparing two tree-shaped things).

I do not think this mode is common enough to deserve to be in the short help text, but it should be in the documentation, perhaps like this patch, I think.

 Documentation/git-diff.txt | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git c/Documentation/git-diff.txt w/Documentation/git-diff.txt
index f8d0819..f8c0601 100644
--- c/Documentation/git-diff.txt
+++ w/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] <blob> <blob>
 'git diff' [options] [--no-index] [--] <path> <path>
 
 DESCRIPTION
@@ -55,6 +56,11 @@ directories. This behavior can be forced by --no-index.
 	This is to view the changes between two arbitrary
 	<commit>.
 
+'git diff' [options] <blob> <blob>::
+
+	This form is to view the differences between the raw
+	contents of two blob objects.
+
 'git diff' [--options] <commit>..<commit> [--] [<path>...]::
 
 	This is synonymous to the previous form.  If <commit> on
@@ -72,8 +78,7 @@ directories. This behavior can be forced by --no-index.
 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
-<tree>.  The third form ('git diff <commit> <commit>') can also
-be used to compare two <blob> objects.
+<tree>.
 
 For a more complete list of ways to spell <commit>, see
 "SPECIFYING REVISIONS" section in linkgit:gitrevisions[7].
Previous: Manlio Perillo
Message 4 of 4 in “Incorrect man page for git-diff”
  1. Manlio PerilloDec 18, 2012
  2. Junio C HamanoDec 18, 2012
  3. Manlio PerilloDec 18, 2012
  4. Junio C HamanoDec 18, 2012

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.