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

Re: About git-diff

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 11, 2011, 04:49 UTC
Message-ID
<7vr54sr1qi.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1313024025.97405.YahooMailClassic@web121818.mail.ne1.yahoo.com>
Luiz Ramos <luizzramos@yahoo.com.br> writes:
Show 10 quoted lines
> Given this, I'd suggest to change the inline documentation of git-diff (git help diff). In the version of my machine (1.7.4.4), it's like that:
>
> (snip)
> ...
>        git diff [--options] <commit> [--] [<path>...]
>            This form is to view the changes you have in your working tree
>            relative to the named <commit>. You can use HEAD to compare it with
>            the latest commit, or a branch name to compare with the tip of a
>            different branch.
> ...

Strictly speaking, "the changes you have in your working tree" may be what is confusing. Your working tree does _not_ have "changes"; it only has "contents". Changes are perceived only if you compare it with something else, as their _difference_.

This operation compares "the contents of tracked files in your working tree" with "the contents recorded in the named <commit>"---the result of this comparison comparison matches what humans perceive as "changes".

So perhaps updating the first sentence with:
	Compare the contents of tracked files in your working tree with
	what is recorded in the named <commit>.

would be all that is necessary. I didn't bother to look but I suspect we have a simlar description for "git diff [--options] [--] [<path>...]" form, and it should be updated in a similar way (the only difference is that it compares "with what is recorded in the index").

Previous: Luiz RamosNext: Luiz Ramos
Message 4 of 5 in “About git-diff”
  1. Luiz RamosAug 10, 2011
  2. Andreas SchwabAug 10, 2011
  3. Luiz RamosAug 11, 2011
  4. Junio C HamanoAug 11, 2011
  5. Luiz RamosAug 11, 2011

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.