Re: [RFC] Introduce .git/BRANCH to point to the current branch
- From
Robin Rosenberg <robin.rosenberg.lists@dewire.com>
- Date
- Dec 6, 2007, 23:39 UTC
- Message-ID
- <200712070039.55249.robin.rosenberg.lists@dewire.com>
- In-Reply-To
- <7vir3e428i.fsf@gitster.siamese.dyndns.org>
tisdag 04 december 2007 skrev Junio C Hamano:
Show 20 quoted lines
> Jakub Narebski <jnareb@gmail.com> writes:
>
> >> Currently, I can do:
> >>
> >> # Oh, what did this look like two commits ago?
> >> $ git checkout HEAD^^
> >> # Ah, OK, let's go back to the tip
> >> $ git checkout branch-name
> >> ^^^^^^^^^^^
> >> But I have to remember and re-type the branch name.
> >
> > No, you don't have. You can use
> > $ git checkout ORIG_HEAD
> > or
> > $ git checkout HEAD@{1}
>
> But the point is he wants to go back to the branch he came from. He
> does not want to detach HEAD at the original commit.
>
> Having said that, I am not sympathetic to "I have to remember".I abuse git bisect for this temporary switcing. It only gives me a one level memory, but otoh the git prompt tells me I'm on a discourse.
[me@lathund GIT (rr/abspath|BISECTING)]$ git checkout master Switched to branch "master"
[me@lathund GIT (master|BISECTING)]$ git checkout HEAD~2 Note: moving to "HEAD~2" 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 afcc4f7... Merge branch 'js/prune-expire'
[me@lathund GIT (afcc4f7...|BISECTING)]$ git bisect reset Previous HEAD position was afcc4f7... Merge branch 'js/prune-expire' Switched to branch "rr/abspath" [me@lathund GIT (rr/abspath)]$
-- robin