{"thread":{"id":"13402","subject":"git-checkout sometimes silently fails","startedAt":"2008-05-06T19:22:56Z","lastAt":"2008-05-07T15:09:27Z","messageCount":10,"participants":["Andrew Morton","Alex Riesen","Jeff King","Junio C Hamano","Björn Steinbrink","Johannes Sixt","J. Bruce Fields"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"76220","messageId":"20080506122256.04ca7d77.akpm@linux-foundation.org","threadId":"13402","inReplyTo":null,"subject":"git-checkout sometimes silently fails","fromName":"Andrew Morton","fromEmail":"akpm@linux-foundation.org","sentAt":"2008-05-06T19:22:56Z","receivedAt":"2008-05-06T19:22:56Z","isPatch":false,"sender":{"key":"akpm@linux-foundation.org","avatar":null},"body":"\nI've had this happen before and I don't know what to do to make it stop. \nUsually sufficient fiddling will prevent it from happening.\n\n\ny:/usr/src/git26> cat .git/branches/linux-next \ngit+ssh://master.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git\n\ny:/usr/src/git26> git-checkout master\nSwitched to branch \"master\"\ny:/usr/src/git26> cat kernel/*.c|sum\n34439  2057\ny:/usr/src/git26> git-checkout linux-next\nSwitched to branch \"linux-next\"\ny:/usr/src/git26> cat kernel/*.c|sum     \n34439  2057\ny:/usr/src/git26> git-checkout origin \nNote: moving to \"origin\" which isn't a local branch\nIf you want to create a new branch from this checkout, you may do so\n(now or later) by using -b with the checkout command again. Example:\n  git checkout -b <new_branch_name>\nHEAD is now at 5717922... Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb\ny:/usr/src/git26> cat kernel/*.c|sum          \n34439  2057\n\n\ny:/usr/src/git26> git --version\ngit version 1.5.5.rc1\n\nhelp?\n"},{"id":"76224","messageId":"20080506215049.GC4647@steel.home","threadId":"13402","inReplyTo":"20080506122256.04ca7d77.akpm@linux-foundation.org","subject":"Re: git-checkout sometimes silently fails","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2008-05-06T21:50:49Z","receivedAt":"2008-05-06T21:50:49Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Andrew Morton, Tue, May 06, 2008 21:22:56 +0200:\n> \n> I've had this happen before and I don't know what to do to make it stop. \n> Usually sufficient fiddling will prevent it from happening.\n> \n> \n> y:/usr/src/git26> cat .git/branches/linux-next \n> git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git\n> \n> y:/usr/src/git26> git-checkout master\n> Switched to branch \"master\"\n> y:/usr/src/git26> cat kernel/*.c|sum\n> 34439  2057\n> y:/usr/src/git26> git-checkout linux-next\n> Switched to branch \"linux-next\"\n> y:/usr/src/git26> cat kernel/*.c|sum     \n> 34439  2057\n\nThis is not a good indication of a failed checkout (they could point\nto the same commit, for one). Try \"gitk master...linux-next\" (or \"git\nlog master..linux-next\", \"git diff master linux-next\")\n\n> y:/usr/src/git26> git-checkout origin \n> Note: moving to \"origin\" which isn't a local branch\n> If you want to create a new branch from this checkout, you may do so\n> (now or later) by using -b with the checkout command again. Example:\n>   git checkout -b <new_branch_name>\n> HEAD is now at 5717922... Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb\n\nThis is not an error. The commit was checked out (and HEAD was\n\"detached\").\n\n> y:/usr/src/git26> cat kernel/*.c|sum          \n> 34439  2057\n\nAgain, it is no indication nothing happened. \"gitk HEAD...linux-next\"\n\n> y:/usr/src/git26> git --version\n> git version 1.5.5.rc1\n> \n> help?\n\nLook at \"git branch -av\" (it shows both local and remote branches and\ncommits they point to). Maybe it will give you a hint. \"gitk --all\" is\ninteresting too, seldom though (it becomes very confusing very fast if\nyou have many branches with complicated history each).\n"},{"id":"76232","messageId":"20080506171052.340d643e.akpm@linux-foundation.org","threadId":"13402","inReplyTo":"20080506215049.GC4647@steel.home","subject":"Re: git-checkout sometimes silently fails","fromName":"Andrew Morton","fromEmail":"akpm@linux-foundation.org","sentAt":"2008-05-07T00:10:52Z","receivedAt":"2008-05-07T00:10:52Z","isPatch":false,"sender":{"key":"akpm@linux-foundation.org","avatar":null},"body":"On Tue, 6 May 2008 23:50:49 +0200 Alex Riesen <raa.lkml@gmail.com> wrote:\n\n> Andrew Morton, Tue, May 06, 2008 21:22:56 +0200:\n> > \n> > I've had this happen before and I don't know what to do to make it stop. \n> > Usually sufficient fiddling will prevent it from happening.\n> > \n> > \n> > y:/usr/src/git26> cat .git/branches/linux-next \n> > git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git\n> > \n> > y:/usr/src/git26> git-checkout master\n> > Switched to branch \"master\"\n> > y:/usr/src/git26> cat kernel/*.c|sum\n> > 34439  2057\n> > y:/usr/src/git26> git-checkout linux-next\n> > Switched to branch \"linux-next\"\n> > y:/usr/src/git26> cat kernel/*.c|sum     \n> > 34439  2057\n> \n> This is not a good indication of a failed checkout (they could point\n> to the same commit, for one).\n\nHow could they?  linux-next includes a directory called ./Next and a file\nin that directory called ./Next/Trees, and that is not present after the\n`git-checkout linux-next'.\n\n> Try \"gitk master...linux-next\" (or \"git\n> log master..linux-next\", \"git diff master linux-next\")\n\nThese come up empty.  But there is a 12.4MB diff between mainline and\nlinux-next.\n\n> > y:/usr/src/git26> git-checkout origin \n> > Note: moving to \"origin\" which isn't a local branch\n> > If you want to create a new branch from this checkout, you may do so\n> > (now or later) by using -b with the checkout command again. Example:\n> >   git checkout -b <new_branch_name>\n> > HEAD is now at 5717922... Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb\n> \n> This is not an error. The commit was checked out (and HEAD was\n> \"detached\").\n> \n> > y:/usr/src/git26> cat kernel/*.c|sum          \n> > 34439  2057\n> \n> Again, it is no indication nothing happened. \"gitk HEAD...linux-next\"\n> \n> > y:/usr/src/git26> git --version\n> > git version 1.5.5.rc1\n> > \n> > help?\n> \n> Look at \"git branch -av\" (it shows both local and remote branches and\n> commits they point to).\n\ny:/usr/src/git26> git-branch -av | grep '^\\*'\n* master               5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb\ny:/usr/src/git26> git-checkout linux-next    \nSwitched to branch \"linux-next\"\ny:/usr/src/git26> git-branch -av | grep '^\\*'\n* linux-next           5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb\n\ny:/usr/src/git26> ls -l Next \nls: cannot access Next: No such file or directory\n\n> Maybe it will give you a hint. \"gitk --all\" is\n> interesting too, seldom though (it becomes very confusing very fast if\n> you have many branches with complicated history each).\n\nhm, lots of stuff there.\n\n\nThing is, sometimes `git-checkout linux-next' works.  Sometimes it\ninexplicably doesn't work and there is no indication from git that it\ndidn't work.\n\nUsually my git problems are root-caused down to my lack of a PhD in\nhermeneutic metaphysiology, but not this time, methinks\n"},{"id":"76234","messageId":"7v4p9bge4q.fsf@gitster.siamese.dyndns.org","threadId":"13402","inReplyTo":"20080506171052.340d643e.akpm@linux-foundation.org","subject":"Re: git-checkout sometimes silently fails","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-07T00:19:01Z","receivedAt":"2008-05-07T00:19:01Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Andrew Morton <akpm@linux-foundation.org> writes:\n\n> y:/usr/src/git26> git-branch -av | grep '^\\*'\n> * master               5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb\n> y:/usr/src/git26> git-checkout linux-next    \n> Switched to branch \"linux-next\"\n> y:/usr/src/git26> git-branch -av | grep '^\\*'\n> * linux-next           5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb\n\nSo your two local branches 'master' and 'linux-next' both point at the\nsame commit, 5717922.\n\n\"git checkout <branchname>\" is to check out the local branch name.  You\nexpect \"git checkout master\" and then \"git checkout linux-next\" to check\nout two different commits because linux-next _should_ have been updated to\nthe latest from sfr repository.  But it appears to me that that is not the\ncase.\n\nPerhaps \"git fetch linux-next\" hasn't been run, before \"git checkout\" was\nattempted?\n"},{"id":"76233","messageId":"20080507001919.GA8633@sigill.intra.peff.net","threadId":"13402","inReplyTo":"20080506171052.340d643e.akpm@linux-foundation.org","subject":"Re: git-checkout sometimes silently fails","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2008-05-07T00:19:19Z","receivedAt":"2008-05-07T00:19:19Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, May 06, 2008 at 05:10:52PM -0700, Andrew Morton wrote:\n\n> > > y:/usr/src/git26> git-checkout master\n> > > Switched to branch \"master\"\n> > > y:/usr/src/git26> cat kernel/*.c|sum\n> > > 34439  2057\n> > > y:/usr/src/git26> git-checkout linux-next\n> > > Switched to branch \"linux-next\"\n> > > y:/usr/src/git26> cat kernel/*.c|sum     \n> > > 34439  2057\n> > \n> > This is not a good indication of a failed checkout (they could point\n> > to the same commit, for one).\n> \n> How could they?  linux-next includes a directory called ./Next and a file\n> in that directory called ./Next/Trees, and that is not present after the\n> `git-checkout linux-next'.\n\nBut you don't show us that in your example. There is nothing in your\nexample to indicate that they are not simply pointing at the same\ncommit...\n\n> > Try \"gitk master...linux-next\" (or \"git\n> > log master..linux-next\", \"git diff master linux-next\")\n> \n> These come up empty.  But there is a 12.4MB diff between mainline and\n> linux-next.\n\nAnd if these all come up empty, then they _are_ pointing to the same\ncommit. When you say \"but there is a 12.4MB diff...\" do you mean \"there\n_should_ be such a diff?\" In that case, it seems that your linux-next\nref is pointing to an unexpected commit.\n\nSo the problem is not with git-checkout, but rather that you are not\nchecking out what you think you are checking out. And so we need to\nfigure out how you got into that state.\n\nWhat command did you use to create the linux-next branch? Have you used\ngit-reset to move the branch tip around?\n\n-Peff\n"},{"id":"76237","messageId":"20080506174348.8d99fe4e.akpm@linux-foundation.org","threadId":"13402","inReplyTo":"7v4p9bge4q.fsf@gitster.siamese.dyndns.org","subject":"Re: git-checkout sometimes silently fails","fromName":"Andrew Morton","fromEmail":"akpm@linux-foundation.org","sentAt":"2008-05-07T00:43:48Z","receivedAt":"2008-05-07T00:43:48Z","isPatch":false,"sender":{"key":"akpm@linux-foundation.org","avatar":null},"body":"On Tue, 06 May 2008 17:19:01 -0700 Junio C Hamano <gitster@pobox.com> wrote:\n\n> Andrew Morton <akpm@linux-foundation.org> writes:\n> \n> > y:/usr/src/git26> git-branch -av | grep '^\\*'\n> > * master               5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb\n> > y:/usr/src/git26> git-checkout linux-next    \n> > Switched to branch \"linux-next\"\n> > y:/usr/src/git26> git-branch -av | grep '^\\*'\n> > * linux-next           5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb\n> \n> So your two local branches 'master' and 'linux-next' both point at the\n> same commit, 5717922.\n> \n> \"git checkout <branchname>\" is to check out the local branch name.  You\n> expect \"git checkout master\" and then \"git checkout linux-next\" to check\n> out two different commits because linux-next _should_ have been updated to\n> the latest from sfr repository.  But it appears to me that that is not the\n> case.\n\nI did a git-fetch of linux-next yesterday.\n\n> Perhaps \"git fetch linux-next\" hasn't been run, before \"git checkout\" was\n> attempted?\n\nI reran `git-fetch linux-next' and that downlaoded a heap of stuff (perhaps\nnecause linux-next rebases every time?) and after this, `git-checkout\nlinux-next' gives me what I expect.\n\nBut how come I couldn't check out yesterday's linux-next?\n"},{"id":"76239","messageId":"20080506175442.845ca8fa.akpm@linux-foundation.org","threadId":"13402","inReplyTo":"20080507001919.GA8633@sigill.intra.peff.net","subject":"Re: git-checkout sometimes silently fails","fromName":"Andrew Morton","fromEmail":"akpm@linux-foundation.org","sentAt":"2008-05-07T00:54:42Z","receivedAt":"2008-05-07T00:54:42Z","isPatch":false,"sender":{"key":"akpm@linux-foundation.org","avatar":null},"body":"On Tue, 6 May 2008 20:19:19 -0400 Jeff King <peff@peff.net> wrote:\n\n> On Tue, May 06, 2008 at 05:10:52PM -0700, Andrew Morton wrote:\n> \n> > > > y:/usr/src/git26> git-checkout master\n> > > > Switched to branch \"master\"\n> > > > y:/usr/src/git26> cat kernel/*.c|sum\n> > > > 34439  2057\n> > > > y:/usr/src/git26> git-checkout linux-next\n> > > > Switched to branch \"linux-next\"\n> > > > y:/usr/src/git26> cat kernel/*.c|sum     \n> > > > 34439  2057\n> > > \n> > > This is not a good indication of a failed checkout (they could point\n> > > to the same commit, for one).\n> > \n> > How could they?  linux-next includes a directory called ./Next and a file\n> > in that directory called ./Next/Trees, and that is not present after the\n> > `git-checkout linux-next'.\n> \n> But you don't show us that in your example. There is nothing in your\n> example to indicate that they are not simply pointing at the same\n> commit...\n> \n> > > Try \"gitk master...linux-next\" (or \"git\n> > > log master..linux-next\", \"git diff master linux-next\")\n> > \n> > These come up empty.  But there is a 12.4MB diff between mainline and\n> > linux-next.\n> \n> And if these all come up empty, then they _are_ pointing to the same\n> commit. When you say \"but there is a 12.4MB diff...\" do you mean \"there\n> _should_ be such a diff?\" In that case, it seems that your linux-next\n> ref is pointing to an unexpected commit.\n> \n> So the problem is not with git-checkout, but rather that you are not\n> checking out what you think you are checking out.\n\nThat sounds a decent theory.\n\n> And so we need to\n> figure out how you got into that state.\n\nWell it happens pretty regularly.  I have now lost that state but I'll save\nit next time.  I'm not able to pinpoint exactly what causes it to occur.\n\n> What command did you use to create the linux-next branch?\n\nI edited \n\ny:/usr/src/git26> cat .git/branches/linux-next \ngit+ssh://master.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git\n\nand did git-fetch once per day, approx.\n\n> Have you used\n> git-reset to move the branch tip around?\n\nMy git-fetching script does that:\n\ndoit()\n{\n\ttree=$1\n\tupstream=$2\n\n\tcd $GIT_TREE\n\tgit reset --hard \"$upstream\"\n\tgit fetch \"$tree\" || exit 1\n\tgit merge --no-commit 'test merge' HEAD FETCH_HEAD > /dev/null\n\n\t{\n\t\tgit_header \"$tree\"\n\t\tgit log --no-merges ORIG_HEAD..FETCH_HEAD\n\t\tgit diff --patch-with-stat ORIG_HEAD\n\t} >$PULL/$tree.patch\n\t{\n\t\techo DESC\n\t\techo $tree.patch\n\t\techo EDESC\n\t\tgit_header \"$tree\"\n\t\tgit log --no-merges ORIG_HEAD..FETCH_HEAD\n\t} >$PULL/$tree.txt\n\tgit reset --hard \"$upstream\"\n}\n\n(Linus suggested an updated version of this but afaict that won't change\nanything)\n\nBut, as I say, usually this script leaves the tree in a sane state.  But\nsometimes it leaves it in a i-cant-check-stuff-out state.  It's not\nspecific to linux-next, either: I've seen this for a long time, on and off.\nPrior to linux-next's existence.\n"},{"id":"76241","messageId":"20080507013240.GA13661@atjola.homenet","threadId":"13402","inReplyTo":"20080506175442.845ca8fa.akpm@linux-foundation.org","subject":"Re: git-checkout sometimes silently fails","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2008-05-07T01:32:40Z","receivedAt":"2008-05-07T01:32:40Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2008.05.06 17:54:42 -0700, Andrew Morton wrote:\n> On Tue, 6 May 2008 20:19:19 -0400 Jeff King <peff@peff.net> wrote:\n> \n> > On Tue, May 06, 2008 at 05:10:52PM -0700, Andrew Morton wrote:\n> > \n> > > > > y:/usr/src/git26> git-checkout master\n> > > > > Switched to branch \"master\"\n> > > > > y:/usr/src/git26> cat kernel/*.c|sum\n> > > > > 34439  2057\n> > > > > y:/usr/src/git26> git-checkout linux-next\n> > > > > Switched to branch \"linux-next\"\n> > > > > y:/usr/src/git26> cat kernel/*.c|sum     \n> > > > > 34439  2057\n> > > > \n> > > > This is not a good indication of a failed checkout (they could point\n> > > > to the same commit, for one).\n> > > \n> > > How could they?  linux-next includes a directory called ./Next and a file\n> > > in that directory called ./Next/Trees, and that is not present after the\n> > > `git-checkout linux-next'.\n> > \n> > But you don't show us that in your example. There is nothing in your\n> > example to indicate that they are not simply pointing at the same\n> > commit...\n> > \n> > > > Try \"gitk master...linux-next\" (or \"git\n> > > > log master..linux-next\", \"git diff master linux-next\")\n> > > \n> > > These come up empty.  But there is a 12.4MB diff between mainline and\n> > > linux-next.\n> > \n> > And if these all come up empty, then they _are_ pointing to the same\n> > commit. When you say \"but there is a 12.4MB diff...\" do you mean \"there\n> > _should_ be such a diff?\" In that case, it seems that your linux-next\n> > ref is pointing to an unexpected commit.\n> > \n> > So the problem is not with git-checkout, but rather that you are not\n> > checking out what you think you are checking out.\n> \n> That sounds a decent theory.\n> \n> > And so we need to\n> > figure out how you got into that state.\n> \n> Well it happens pretty regularly.  I have now lost that state but I'll save\n> it next time.  I'm not able to pinpoint exactly what causes it to occur.\n> \n> > What command did you use to create the linux-next branch?\n> \n> I edited \n> \n> y:/usr/src/git26> cat .git/branches/linux-next \n> git+ssh://master.kernel.org/pub/scm/linux/kernel/git/sfr/linux-next.git\n> \n> and did git-fetch once per day, approx.\n> \n> > Have you used\n> > git-reset to move the branch tip around?\n> \n> My git-fetching script does that:\n> \n> doit()\n> {\n> \ttree=$1\n> \tupstream=$2\n> \n> \tcd $GIT_TREE\n> \tgit reset --hard \"$upstream\"\n> \tgit fetch \"$tree\" || exit 1\n> \tgit merge --no-commit 'test merge' HEAD FETCH_HEAD > /dev/null\n> \n> \t{\n> \t\tgit_header \"$tree\"\n> \t\tgit log --no-merges ORIG_HEAD..FETCH_HEAD\n> \t\tgit diff --patch-with-stat ORIG_HEAD\n> \t} >$PULL/$tree.patch\n> \t{\n> \t\techo DESC\n> \t\techo $tree.patch\n> \t\techo EDESC\n> \t\tgit_header \"$tree\"\n> \t\tgit log --no-merges ORIG_HEAD..FETCH_HEAD\n> \t} >$PULL/$tree.txt\n> \tgit reset --hard \"$upstream\"\n> }\n> \n> (Linus suggested an updated version of this but afaict that won't change\n> anything)\n> \n> But, as I say, usually this script leaves the tree in a sane state.  But\n> sometimes it leaves it in a i-cant-check-stuff-out state.  It's not\n> specific to linux-next, either: I've seen this for a long time, on and off.\n> Prior to linux-next's existence.\n\nHm, that very much looks like it would mess things up whenever you're\nnot on the upstream branch already.\n\nWhile this should do no harm:\ngit checkout master\ndoit linux-next master\n\nThis will make your linux-next branch point to the same commit as\nmaster:\ngit checkout linux-next\ndoit linux-next master\n\nAdding a '\"git checkout \"$upstream\"' (maybe with -f?) before the first\nreset --hard should avoid that then.\n\nBjörn\n"},{"id":"76261","messageId":"48216DAD.50902@viscovery.net","threadId":"13402","inReplyTo":"20080506171052.340d643e.akpm@linux-foundation.org","subject":"Re: git-checkout sometimes silently fails","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-05-07T08:51:57Z","receivedAt":"2008-05-07T08:51:57Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Andrew Morton schrieb:\n> y:/usr/src/git26> git-branch -av | grep '^\\*'\n> * master               5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb\n> y:/usr/src/git26> git-checkout linux-next    \n> Switched to branch \"linux-next\"\n> y:/usr/src/git26> git-branch -av | grep '^\\*'\n> * linux-next           5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb\n\nYou did not show us the output of 'git branch -av'. Do you happen to see\nsomething like this in the output:\n\n* master               5717922 Merge branch 'for_linus'\n  linux-next           5717922 Merge branch 'for_linus'\n  linux-next/HEAD      1234567 Something completely different\n  linux-next/master    1234567 Something completely different\n\nIn this case, your local branch 'linux-next' is probably a left-over from\nearlier experiments. The last two branches are actually what you want to\nrefer to. Normally, the 'linux-next/HEAD' part allows you to refer to\n'linux-next/master' by saying simply 'linux-next'. But unfortunately, your\nlocal branch name 'linux-next' takes precedence.\n\n'git fetch' never updates your local branch, but only 'linux-next/master'\n(and its alias 'linux-next/HEAD' aka 'linux-next').\n\nTo return to a sane state, do 'git branch -D linux-next'.\n\n-- Hannes\n"},{"id":"76288","messageId":"20080507150927.GA11447@fieldses.org","threadId":"13402","inReplyTo":"7v4p9bge4q.fsf@gitster.siamese.dyndns.org","subject":"Re: git-checkout sometimes silently fails","fromName":"J. Bruce Fields","fromEmail":"bfields@fieldses.org","sentAt":"2008-05-07T15:09:27Z","receivedAt":"2008-05-07T15:09:27Z","isPatch":false,"sender":{"key":"bfields@citi.umich.edu","avatar":null},"body":"On Tue, May 06, 2008 at 05:19:01PM -0700, Junio C Hamano wrote:\n> Andrew Morton <akpm@linux-foundation.org> writes:\n> \n> > y:/usr/src/git26> git-branch -av | grep '^\\*'\n> > * master               5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb\n> > y:/usr/src/git26> git-checkout linux-next    \n> > Switched to branch \"linux-next\"\n> > y:/usr/src/git26> git-branch -av | grep '^\\*'\n> > * linux-next           5717922 Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb\n> \n> So your two local branches 'master' and 'linux-next' both point at the\n> same commit, 5717922.\n> \n> \"git checkout <branchname>\" is to check out the local branch name.  You\n> expect \"git checkout master\" and then \"git checkout linux-next\" to check\n> out two different commits because linux-next _should_ have been updated to\n> the latest from sfr repository.  But it appears to me that that is not the\n> case.\n> \n> Perhaps \"git fetch linux-next\" hasn't been run, before \"git checkout\" was\n> attempted?\n\nMight also be worth checking whether there happens to be a tag (or\nsomething else?) named the same as one of the branches?  I remember the\npublic -mm git repo, for example, having a tag named \"master\".  Yuch.\n\nGrepping through git-for-each-ref output might shed some light.\n\n--b.\n"}]}