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

Re: git-checkout sometimes silently fails

From
Alex Riesen <raa.lkml@gmail.com>
Date
May 6, 2008, 21:50 UTC
Message-ID
<20080506215049.GC4647@steel.home>
In-Reply-To
<20080506122256.04ca7d77.akpm@linux-foundation.org>
Andrew Morton, Tue, May 06, 2008 21:22:56 +0200:
Show 16 quoted lines
> 
> I've had this happen before and I don't know what to do to make it stop. 
> Usually sufficient fiddling will prevent it from happening.
> 
> 
> y:/usr/src/git26> cat .git/branches/linux-next 
> git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git
> 
> y:/usr/src/git26> git-checkout master
> Switched to branch "master"
> y:/usr/src/git26> cat kernel/*.c|sum
> 34439  2057
> y:/usr/src/git26> git-checkout linux-next
> Switched to branch "linux-next"
> y:/usr/src/git26> cat kernel/*.c|sum     
> 34439  2057

This is not a good indication of a failed checkout (they could point to the same commit, for one). Try "gitk master...linux-next" (or "git log master..linux-next", "git diff master linux-next")

Show 6 quoted lines
> y:/usr/src/git26> git-checkout origin 
> Note: moving to "origin" which isn't a local branch
> If you want to create a new branch from this checkout, you may do so
> (now or later) by using -b with the checkout command again. Example:
>   git checkout -b <new_branch_name>
> HEAD is now at 5717922... Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb

This is not an error. The commit was checked out (and HEAD was "detached").

> y:/usr/src/git26> cat kernel/*.c|sum          
> 34439  2057
Again, it is no indication nothing happened. "gitk HEAD...linux-next"
> y:/usr/src/git26> git --version
> git version 1.5.5.rc1
> 
> help?

Look at "git branch -av" (it shows both local and remote branches and commits they point to). Maybe it will give you a hint. "gitk --all" is interesting too, seldom though (it becomes very confusing very fast if you have many branches with complicated history each).

Previous: Andrew MortonNext: Andrew Morton
Message 2 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.