git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-checkout sometimes silently fails

From
Johannes Sixt <j.sixt@viscovery.net>
Date
May 7, 2008, 08:51 UTC
Message-ID
<48216DAD.50902@viscovery.net>
In-Reply-To
<20080506171052.340d643e.akpm@linux-foundation.org>
Andrew Morton schrieb:
Show 6 quoted lines
> y:/usr/src/git26> git-branch -av | grep '^\*'
> * master               5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb
> y:/usr/src/git26> git-checkout linux-next    
> Switched to branch "linux-next"
> y:/usr/src/git26> git-branch -av | grep '^\*'
> * linux-next           5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb

You did not show us the output of 'git branch -av'. Do you happen to see something like this in the output:

* master               5717922 Merge branch 'for_linus'
  linux-next           5717922 Merge branch 'for_linus'
  linux-next/HEAD      1234567 Something completely different
  linux-next/master    1234567 Something completely different

In this case, your local branch 'linux-next' is probably a left-over from earlier experiments. The last two branches are actually what you want to refer to. Normally, the 'linux-next/HEAD' part allows you to refer to 'linux-next/master' by saying simply 'linux-next'. But unfortunately, your local branch name 'linux-next' takes precedence.

'git fetch' never updates your local branch, but only 'linux-next/master' (and its alias 'linux-next/HEAD' aka 'linux-next').

To return to a sane state, do 'git branch -D linux-next'.
-- Hannes
Previous: Björn Steinbrink
Message 10 of 10 in “git-checkout sometimes silently fails”
  1. Andrew MortonMay 6, 2008
  2. Alex RiesenMay 6, 2008
  3. Andrew MortonMay 7, 2008
  4. Junio C HamanoMay 7, 2008
  5. Andrew MortonMay 7, 2008
  6. J. Bruce FieldsMay 7, 2008
  7. Jeff KingMay 7, 2008
  8. Andrew MortonMay 7, 2008
  9. Björn SteinbrinkMay 7, 2008
  10. Johannes SixtMay 7, 2008

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.