git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jona Christopher Sahnwaldt <jc@sahnwaldt.de>
To: git@vger.kernel.org
Subject: "git checkout foo" is getting confused by folder named "foo"
Date: Tue, 24 Sep 2013 23:07:53 +0200	[thread overview]
Message-ID: <CAEQewpqLcDJPo2gUWPk-xc3OitdTC4gH2tnyqaURiQ77BApNog@mail.gmail.com> (raw)

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.

I got the same behavior with git 1.8.3.2 on a Mac and git 1.7.9.5 on Linux.

Steps to reproduce:

git clone https://github.com/dbpedia/extraction-framework.git
cd extraction-framework/

First the happy path - there is a remote branch "live-dev", but no
folder "extraction-framework/live-dev":

git checkout live-dev

Response:

Branch live-dev set up to track remote branch live-dev from origin.
Switched to a new branch 'live-dev'

Fine! Now the unhappy path - there is a branch "wiktionary", but also
a folder "extraction-framework/wiktionary":

git checkout wiktionary

Nothing - no response, no changes to working tree. .git/index seems to
be modified though.

Slightly different - cd to some folder, try checkout again:

cd mappings
git checkout wiktionary

Response:

error: pathspec 'wiktionary' did not match any file(s) known to git.


My workaround is that when I switch to a branch for the first time, I
have to call

git checkout -t -b wiktionary --track origin/wiktionary

Response:

Branch wiktionary set up to track remote branch wiktionary from origin.
Switched to a new branch 'wiktionary'

Looks good. After that, I can switch back and forth between branches
just by git checkout wiktionary / git checkout master.


Cheers,
Christopher

             reply	other threads:[~2013-09-24 21:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-24 21:07 Jona Christopher Sahnwaldt [this message]
2013-09-25  2:51 ` "git checkout foo" is getting confused by folder named "foo" David Aguilar
2013-09-25  3:13   ` Keshav Kini
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=CAEQewpqLcDJPo2gUWPk-xc3OitdTC4gH2tnyqaURiQ77BApNog@mail.gmail.com \
    --to=jc@sahnwaldt.de \
    --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).