Re: ref name troubles, was Re: [PATCH v2] Introduce %<branch> as shortcut to the tracked branch
- From
Shawn O. Pearce <spearce@spearce.org>
- Date
- Mar 20, 2009, 00:40 UTC
- Message-ID
- <20090320004029.GX23521@spearce.org>
- In-Reply-To
- <alpine.DEB.1.00.0903200137230.10279@pacific.mpi-cbg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 13 quoted lines
> On Fri, 20 Mar 2009, Johannes Schindelin wrote:
>
> > Just try this:
> >
> > $ git checkout -b %helloworld
>
> It gets worse. Much worse.
>
> Try this (triggered by a comment by Ilari on IRC):
>
> $ git checkout -b '@{1}'
>
> That _works_! WTH?'@' is not reserved. Neither is '{' or '}'. Neither is the combination.
Waaaaaay back when I added reflog query syntax I tried to use only '@', people with branch names like 'foo@bar' made a point that they didn't want to reserve it. We stuck the {} in as a "highly unlikely to conflict with a branch name" and others pointed out most shells will do fun things with those, but we kept it to avoid ambiguous meanings of "foo@noon" when foo@noon is already a branch.
Fast-forward more than 2 years, and the "@{...}" syntax is quite widely used, perhaps more so than "@" in a branch name. But its still not reserved.
So yea, you can create a branch named "foo@{1}".$ git branch foo@{1}
$ git branch
cache-walk
foo@{1}
master
* mergebase-bug
mw/blame
rr/compareeditor
transport-mirror
worktree-api
worktree-editYay.
-- Shawn.