git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [funny] "git checkout -t origin/xyzzy" seems to misbehave
@ 2008-09-21  8:23 Junio C Hamano
  2008-09-21 17:44 ` Alex Riesen
  2008-09-21 18:36 ` Daniel Barkalow
  0 siblings, 2 replies; 3+ messages in thread
From: Junio C Hamano @ 2008-09-21  8:23 UTC (permalink / raw)
  To: git; +Cc: Johannes Schindelin, Daniel Barkalow

When you

 * are on a branch "foo" that is not "bar",
 * have "origin/bar",
 * and already have a local branch "bar",

"git checkout -t origin/bar" seems to misbehave.

    $ git clone -s git.junio victim-002
    $ cd victim-002
    $ git branch
    * master
    $ git checkout -t origin/next
    Branch next set up to track remote branch refs/remotes/origin/next.
    Switched to a new branch "next"
    $ git checkout -t origin/master
    fatal: A branch named 'master' already exists.
    $ git branch
      master
    * next
    $ git diff --cached --shortstat
     60 files changed, 2378 insertions(+), 3412 deletions(-)
    $ git diff --cached master
    $ exit

The first "checkout -t" is fine.  The failed one seems to have already
updated the index and the work tree when it notices that it cannot create
a new branch.

I suspect "-t" does not have to be in effect to trigger this; in other
words, "git checkout -b master origin/master" would have the same issue.

I'm reporting this before digging it further myself, because I may not be
able to diagnose this before I leave for a vacation.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-09-22 17:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-21  8:23 [funny] "git checkout -t origin/xyzzy" seems to misbehave Junio C Hamano
2008-09-21 17:44 ` Alex Riesen
2008-09-21 18:36 ` Daniel Barkalow

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).