Re: [PATCH] Add new @ shortcut for HEAD
From: Duy Nguyen <hidden>
Date: 2016-06-15 22:57:04
On Tue, Apr 30, 2013 at 2:09 PM, Michael Haggerty [off-list ref] wrote:
According to git-check-ref-format(1), an "@" character is currently
legal in a reference name as long as it is not followed by "{". As an
example, git-svn uses "@" in reference names (e.g.,
"refs/remotes/svn/tags/foo@56945"), I believe when a Subversion branch
or tag is deleted then re-created.Thanks! I was looking for this document but couldn't remember its name.
Amusingly, it is already possible to define a reference or symbolic
reference named "@". So all that you need to do is type
git symbolic-ref -m "Create @ alias for HEAD" @ HEAD
to get the shortcut that you want :-)Not so amusingly (and off topic), why reading the code this patch touches, I think if we have a ref whose last component is exactly 40 chars and contains only [0-9a-fA-F], then we simply consider it sha-1 and return without reading the ref. -- Duy