From: Keshav Kini <keshav.kini@gmail.com>
To: git@vger.kernel.org
Subject: Re: "git checkout foo" is getting confused by folder named "foo"
Date: Tue, 24 Sep 2013 22:13:43 -0500 [thread overview]
Message-ID: <87y56lsie0.fsf@gmail.com> (raw)
In-Reply-To: CAJDDKr64ou+gO7WJLFZ4zOSv+VCbkiW7nKuZa9=5_fiSqGUeyQ@mail.gmail.com
David Aguilar <davvid@gmail.com> writes:
> 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 --
>
> 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 https://github.com/dbpedia/extraction-framework.git
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
live-dev
* master
[2] fs@erdos /tmp/extraction-framework $ git checkout wiktionary --
fatal: invalid reference: wiktionary
-Keshav
next prev parent reply other threads:[~2013-09-25 3:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-24 21:07 "git checkout foo" is getting confused by folder named "foo" Jona Christopher Sahnwaldt
2013-09-25 2:51 ` David Aguilar
2013-09-25 3:13 ` Keshav Kini [this message]
2013-09-25 3:33 ` Duy Nguyen
2013-09-25 8:58 ` Jona Christopher Sahnwaldt
2013-09-25 13:09 ` Matthieu Moy
2013-09-25 16:24 ` Jona Christopher Sahnwaldt
2013-09-25 19:12 ` Matthieu Moy
2013-09-25 19:36 ` Jona Christopher Sahnwaldt
2013-09-25 20:01 ` Matthieu Moy
2013-09-26 21:25 ` Jona Christopher Sahnwaldt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y56lsie0.fsf@gmail.com \
--to=keshav.kini@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).