On Mon, Oct 07, 2024 at 03:01:29PM -0700, Junio C Hamano wrote: > Kristoffer Haugsbakk <code@xxxxxxxxxxxxxxx> writes: > > > `HEAD` is an invalid branch name.[1] But the `@` synonym is allowed. > > This is just as inconvenient since commands like `git checkout @` will, > > quite sensibly, do `git checkout HEAD` instead of checking out that > > branch; in turn there is no practical reason to use this as a branch > > name since you cannot even check out the branch itself (only check out > > the commit which `refs/heads/@` points to). > > I am not sure this is sensible at all, after all these years. > > I suspect that it is much more productive to deprecate and remove > "@" that is a built-in synomym for HEAD (but "refs/remotes/origin/@" > does not act as a synonym for "refs/remotes/origin/HEAD"). Having > two ways to call the same thing merely adds to confusion in this > case, unlike "HEAD" referring to 'master' (when 'master' is checked > out), which is also to have two ways to call the same thing, but > adds a true convenience. I do not use "@" myself, but I feel like when removing it has been brought up before, it had its defenders. So I do not personally object, but I think you'd have to post a patch and see who screams. :) > Those who really want to use @ can do something like > > $ echo "ref: HEAD" >.git/@ > > or something, perhaps. I'm not sure if we'll allow that long-term. It does not match the root-ref syntax, so I'm not sure if it would pass check_ref_format(). (Sorry, I had a series a few months ago cleaning up some edges cases there, but I haven't gotten back to it yet). -Peff