David Aguilar <dav...@gmail.com> writes:

> On Tue, Sep 24, 2013 at 2:07 PM, Jona Christopher Sahnwaldt
> <j...@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 --
> 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).

I was going to reply with similar advice, but I actually tried it on the
example repo and it didn't work. Apparently it doesn't interoperate
properly with the functionality that guesses when you're trying to check
out a remote branch and creates an equivalently named local branch.

    [2] fs@erdos /tmp $ git clone 
    Cloning into 'extraction-framework'...
    remote: Counting objects: 33513, done.
    remote: Compressing objects: 100% (6633/6633), done.
    remote: Total 33513 (delta 19000), reused 32922 (delta 18436)
    Receiving objects: 100% (33513/33513), 23.48 MiB | 747.00 KiB/s, done.
    Resolving deltas: 100% (19000/19000), done.
    Checking connectivity... done
    [2] fs@erdos /tmp $ cd extraction-framework/
    [2] fs@erdos /tmp/extraction-framework $ git checkout live-dev --
    fatal: invalid reference: live-dev
    [2] fs@erdos /tmp/extraction-framework $ git checkout live-dev
    Branch live-dev set up to track remote branch live-dev from origin.
    Switched to a new branch 'live-dev'
    [2] fs@erdos /tmp/extraction-framework $ git checkout master
    Switched to branch 'master'
    [2] fs@erdos /tmp/extraction-framework $ git checkout wiktionary
    [2] fs@erdos /tmp/extraction-framework $ git branch
    * master
    [2] fs@erdos /tmp/extraction-framework $ git checkout wiktionary --
    fatal: invalid reference: wiktionary


To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to