Re: master^ is not a local branch -- huh?!?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In article <hjvgs1$rep$1@xxxxxxxxxxxxx>,
 "Scott R. Godin" <scottg.wp-hackers@xxxxxxxx> wrote:

> On 01/29/2010 03:20 PM, Ron1 wrote:
> > [ron@mickey]$ git checkout master
> > Already on 'master'
> > [ron@mickey]$ git checkout master^
> > Note: moving to 'master^' 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 7be05e0... test
> > [ron@mickey]$ git branch
> > * (no branch)
> >    master
> > [ron@mickey]$
> >
> > Huh?!?
> >
> > This is a test repository which has never been pulled from nor pushed to
> > anywhere.  So how is it possible that I have a non-local branch?
> >
> > Thanks,
> > rg
> >
> 
> I believe what you're seeing is known as a detached head (see 
> <http://www.kernel.org/pub/software/scm/git/docs/git-checkout.html> 
> though I could be wrong about this.)
> 
> I think you may have intended to do git checkout HEAD^ or something 
> similar?

Yes, in fact that is exactly what I am trying to do.  But that has the 
same result.

> basically what you did was (I think) checkout (or attempt to 
> checkout) the parent commit on master.

Yes.  I posted it that way simply because 'git commit HEAD' depends on 
what HEAD is.  If HEAD is the head of master (which it was) then the 
result is the same.

> 
> this may offer some additional food for thought: 
> <http://www.kernel.org/pub/software/scm/git/docs/gittutorial.html#_exploring_h
> istory>

Yes, I read that.  But what I'm trying to do is not just *look* at the 
history, I want to restore my working tree to a previous version.  The 
"Exploring History" section of the docs doesn't say how to do that.

rg

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]