Re: [PATCH] checkout: implement "-" shortcut name for last branch
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 15, 2009, 00:45 UTC
- Message-ID
- <alpine.DEB.1.00.0901150141570.3586@pacific.mpi-cbg.de>
- In-Reply-To
- <1231977976-8739-1-git-send-email-trast@student.ethz.ch>
Hi,
On Thu, 15 Jan 2009, Thomas Rast wrote:
> Let git-checkout save the old branch as a symref in LAST_HEAD, and > make 'git checkout -' switch back to LAST_HEAD, like 'cd -' does in > the shell.
Actually, what you want is in the reflog, no? So... parsing .git/logs/HEAD for the latest occurrence of "checkout: moving from " and then using everything up until the next space should give you the branch name, right?
It could be a SHA-1, though, if the last branch switch was from a detached HEAD, though.
Ciao, Dscho