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

Re: Fwd: [RFC/FR] Should "git checkout (-B|-b) branch master...branch" work?

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 21, 2012, 17:12 UTC
Message-ID
<7vr4mj1g8j.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CANiSa6ibS7ORY=QMS3WQzXYJQQH4ZYvPO75qgLgv-oWGMSBBrw@mail.gmail.com>
Martin von Zweigbergk <martinvonz@gmail.com> writes:
> I keep forgetting what "git diff A..B" does.

"diff" is always about two endpoints, not the path that connects these two endpoints (aka "range"), and when you want to "diff" between two commits, you say "diff A B". "A..B" happens to be accepted as such only by accident (e.g. the old command line parser did not have a reliable way to tell "^A B" and "A..B" apart), not by design.

    side note: incidentally, now we have rev_cmdline_info support,
    we could start deprecating "diff A..B" syntax.

The special case "git checkout master...branch" is not about specifying a range. The command knows it wants a single point (not two endpoints, nor a range), and A...B as a notation to specify a single point is $(merge-base A B).

> I would have much preferred if
> it was possible to make the revision parser generally interpret e.g.
> "A.^.B" as "the merge base of A and B" (failing if not exactly one).

Actually, in many places where the command line parser knows it wants a single point, and never a range, we should be able to apply the "A...B as a notation to specify a single point" rule.

Of course you could come up with a symbol other than "..." for that purpose, and migrate the current "git checkout A...B" special case to use that other symbol, but that would be more work and also you would need to retrain existing users.

Previous: Martin von ZweigbergkNext: Michael Haggerty
Message 3 of 7 in “[RFC/FR] Should "git checkout (-B|-b) branch master...branch" work?”
  1. Junio C HamanoDec 21, 2012
  2. Fwd: [RFC/FR] Should "git checkout (-B|-b) branch master...branch" work?Martin von Zweigbergk, Dec 21, 2012
  3. Junio C HamanoDec 21, 2012
  4. Michael HaggertyDec 21, 2012
  5. Martin von ZweigbergkDec 21, 2012
  6. Junio C HamanoDec 21, 2012
  7. Michael HaggertyDec 21, 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.