git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Bug] Porcelain allows creation of '@' branch

From
KHKristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Date
Sep 3, 2026, 08:38 UTC
Message-ID
<958622c0-e0a5-4e27-9815-cd1fff2ed111@app.fastmail.com>
In-Reply-To
<CALnO6CCph_xC394v_BetLPyoriYc9dLZY42LsXhjVNdvt2e-cQ@mail.gmail.com>
On Mon, Aug 31, 2026, at 21:59, D. Ben Knoble wrote:
Show 37 quoted lines
> On Mon, Aug 31, 2026 at 3:12 PM Bence Csókás <bence.csokas@arm.com> wrote:
>>
>> Hi,
>>
>> I ran into this issue a few weeks ago. I'm using Git 2.55.0, which is
>> the latest released.
>>
>> `git help check-ref-format` says this about a branch name:
>>
>>    [...]
>>    9. They cannot be the single character @.
>>    [...]
>
> This is the rule for a reference.
>
>> And as expected, it is rejected:
>>
>>    $ git check-ref-format @ && echo BUG!
>>    $
>>
>> However, the following commands all create a branch named @ :
>>
>>    $ git checkout -b @
>>    $ git switch -c @
>>    $ git branch @
>
> But (with git refs list) we should see this creates a ref "refs/heads/@".
>
> I happen to think that's extremely confusing given that "@" is the
> shorthand for HEAD, but… it's not against the current documented
> rules, I think. (e.g., "git switch @" will fail, since it sees "git
> switch HEAD"; using "refs/heads/@" will also fail.) git-checkout
> doesn't fail but also doesn't change to the "@" branch. Futzing with
> .git/HEAD and restoring the working tree works, but… yikes.
>
> Of course, --branch mode is allowed to be stricter; maybe we should
> reject this case?
Not a bug (2024) https://lore.kernel.org/git/xmqqy12z7eti.fsf@gitster.g/
    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"). [...]
>[snip]
Previous: Jeff KingNext: Bence Csókás
Message 4 of 16 in “[Bug] Porcelain allows creation of '@' branch”
  1. Bence CsókásAug 31, 2026
  2. D. Ben KnobleAug 31, 2026
  3. Jeff KingSep 2, 2026
  4. Kristoffer HaugsbakkSep 3, 2026
  5. Bence CsókásSep 3, 2026
  6. Ben KnobleSep 3, 2026
  7. Junio C HamanoSep 3, 2026
  8. Kristoffer HaugsbakkSep 6, 2026
  9. Bence CsókásOct 15, 2026
  10. Junio C HamanoOct 16, 2026
  11. D. Ben KnobleOct 16, 2026
  12. Kristoffer HaugsbakkOct 16, 2026
  13. Junio C HamanoOct 16, 2026
  14. Kristoffer HaugsbakkOct 17, 2026
  15. Junio C HamanoOct 17, 2026
  16. Junio C HamanoOct 16, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.