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
JSJona Christopher Sahnwaldt <jc@sahnwaldt.de>
Date
Sep 25, 2013, 08:58 UTC
Message-ID
<CAEQewpqbf-sWSt0GS9eXQNi0yFz5-23NcO2JWKO4OgSFv3SXdA@mail.gmail.com>
In-Reply-To
<CAJDDKr64ou+gO7WJLFZ4zOSv+VCbkiW7nKuZa9=5_fiSqGUeyQ@mail.gmail.com>
On 25 September 2013 04:51, David Aguilar <davvid@gmail.com> wrote:
Show 15 quoted lines
> On Tue, Sep 24, 2013 at 2:07 PM, Jona Christopher Sahnwaldt
> <jc@sahnwaldt.de> wrote:
>> Hi,
>>
>> maybe this has already been reported, but I didn't find it in the mail archive.
>>
>> If I understand correctly, after I clone a repo, I should be able to
>> switch to branch foo just by running
>>
>> git checkout foo
>>
>> This doesn't seem to work if a folder called "foo" exists in the root
>> of the repo.
>
> git checkout foo --

Thanks for the suggestion, but it doesn't work for me. With both 1.7.9.5 and 1.8.3.2, I get this:

$ git checkout wiktionary -- fatal: invalid reference: wiktionary

When I try the full branch name:
$ git checkout origin/wiktionary --
Note: checking out 'origin/wiktionary'.
You are in 'detached HEAD' state. You can [...]
:-(
Christopher
Show 7 quoted lines
>
> The double-dash at the end disambiguates between refs and paths.
>
> You can use that trick on any command that accepts refspec (branches,
> tags, etc) and pathspec (path patterns).
> --
> David
Previous: Duy NguyenNext: Matthieu Moy
Message 5 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.