Re: [PATCH v2] checkout: implement "-" shortcut name for last branch
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 16, 2009, 12:31 UTC
- Message-ID
- <alpine.DEB.1.00.0901161329490.3586@pacific.mpi-cbg.de>
- In-Reply-To
- <7vocy8s51o.fsf@gitster.siamese.dyndns.org>
Hi,
On Thu, 15 Jan 2009, Junio C Hamano wrote:
Show 23 quoted lines
> I do not see a reason to limit the new notation "where I was" only to
> "git checkout". Wouldn't it be handy if you can use the notation as the
> other branch to merge from, or the commit to rebase on?
>
> [...]
>
> Another reason is the one level limitation. If we do not use LAST_HEAD,
> and instead used HEAD reflog, to get to this information, there is no
> reason we cannot to give an equally easy access to the second from the
> last branch the user was on.
>
> So I think it is just the matter of coming up with a clever syntax that
> works on reflogs to name the nth last branch we were on and teach that
> syntax to both get_sha1() and resolve_ref().
>
> With the attached illustration patch,
>
> $ git checkout junk
> $ git chekcout master
> $ git checkout @{-1}
>
> will take you back to junk branch. It probably would serve as a starting
> point, if anybody is interested.I like it. Additionaly, we could teach "checkout" that "-" is equivalent to "@{-1}", as checkout cannot possibly take stdin, so it would not hurt. Thomas?
Ciao, Dscho