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

Re: "git checkout foo" is getting confused by folder named "foo"

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Sep 25, 2013, 19:12 UTC
Message-ID
<vpqzjr0pvfn.fsf@anie.imag.fr>
In-Reply-To
<CAEQewpoD2VRVtpEyG121TqAptoYfEXxt57CCthBX_EfN7LU0fQ@mail.gmail.com>
Jona Christopher Sahnwaldt <jc@sahnwaldt.de> writes:
Show 5 quoted lines
> Hi everyone,
>
> tl;dr: The short form "git checkout foo" is a mess. There's simply too
> much "DWIM" magic going on. There are no comprehensible rules how it
> decides if "foo" is a pathspec or a refspec.
There is a very simple rule:

What's on the left hand side of -- are refs, what's on the right hand side are paths.

When you don't use --, then Git tries to guess, and fails whenever there's an ambiguity.

>> OK, what happens is that "git checkout wiktionary" is actually a
>> shorthand for "git checkout -b wiktionary --track origin/wiktionary".
>
> No, it isn't.

What I meant was that the short form advised by people were _meant_ to be a shorthand.

> Let's consider several scenarios:

I don't get your point. Is the overly long list a way of complaining? Are you suggesting a change? What do you think about the change I'm proposing?

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Jona Christopher SahnwaldtNext: Jona Christopher Sahnwaldt
Message 8 of 11 in “"git checkout foo" is getting confused by folder named "foo"”
  1. Jona Christopher SahnwaldtSep 24, 2013
  2. David AguilarSep 25, 2013
  3. Keshav KiniSep 25, 2013
  4. Duy NguyenSep 25, 2013
  5. Jona Christopher SahnwaldtSep 25, 2013
  6. Matthieu MoySep 25, 2013
  7. Jona Christopher SahnwaldtSep 25, 2013
  8. Matthieu MoySep 25, 2013
  9. Jona Christopher SahnwaldtSep 25, 2013
  10. Matthieu MoySep 25, 2013
  11. Jona Christopher SahnwaldtSep 26, 2013

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.