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, 07:07 UTC
Message-ID
<7vlkbxmp50.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20070827014056.GB7422@mediacenter.austin.rr.com>
Shawn Bohrer <shawn.bohrer@gmail.com> writes:
> So if I understand you correctly people in the git world are simply more
> used to typing two dots (instead of three) so that is why the two dot
> notation shows the more common use case (show me the difference between
> the tip of the master branch and the tip of the topic branch).

No, what I said was that two dot form is merely there to avoid saying 'if you want to diff two trees, do not say "diff a..b" but say "diff a b", dummy!'. Instead of giving such an error message, we just say "oh, you want difference between a and b? here it is".

As to which is common between "diff a..b" and "diff a...b", that really depends. You seem to be hinting that you think a...b is more useful but that is not always the case. Comparing two arbitrary trees _is_ the base form of diff, and that is what "diff a b" gives you. It does not require two trees to be related in ancestry relationships in _any_ way. For example, you can say "git diff v2.6.20 v2.6.21" or "git diff v2.6.20.4 v2.6.21.2".

On the other hand, when you are into topic branch development workflow, "diff a...b" is often useful but that does not mean people using topic branch development does not need "diff a b" form. You can say either "diff a b" if you want straight diff between two trees, or "diff a...b" if you want "what happened in b, since it forked from the history leading to a"; if the two-dot form confuses you, you do not have to use that synonym.

Both semantics of two-dot form and three-dot form are useful, and choice between the two depends on what you want out of the command. You just need to know which one you want.

Previous: Mike HommeyNext: Mike Hommey
Message 5 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.