Re: checkout to a reflog entry

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

 



On Tue, Aug 25, 2009 at 12:52:35PM +0800, bill lam wrote:

> project(master)$ git checkout master@{1}
> Note: moving to 'master@{1}' which isn't a local branch
> [...]
> It becomes (no branch) although the SHA1 is correct. If I then
> checkout master, then it revert and jump back up the previous master
> HEAD.  I tried HEAD@{xx} also failed.  What is the correct way of to
> checkout that master@{..} and stay in that master branch?  (Sometimes
> it worked I forgot how and why)

A reflog entry is not a branch; it is just a pointer to the commit where
a branch was at some point. Using "git checkout" on it will let you
explore the contents, just as you might with a tag. If you want to build
on it, you need to either:

  1. Make a new branch to work on, starting at that point:

       git checkout -b my-topic master@{1}

  2. Reset your current branch (and worktree) to point at that commit:

       git reset --hard master@{1}

-Peff
--
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]