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

[Bug] Porcelain allows creation of '@' branch

From
BCBence Csókás <bence.csokas@arm.com>
Date
Aug 31, 2026, 14:22 UTC
Message-ID
<4e8d8b75-ddf4-4602-a2a8-26e5214c65f0@arm.com>
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 @.
   [...]
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 @

I believe this to be a bug. Other invalid names are properly rejected though:

   $ git checkout -b master@{1}
   fatal: 'master@{1}' is not a valid branch name
   hint: See 'git help check-ref-format'
   hint: Disable this message with "git config set advice.refSyntax false"
   $ git checkout -b @{1}
   fatal: '@{1}' is not a valid branch name
   hint: See 'git help check-ref-format'
   hint: Disable this message with "git config set advice.refSyntax false"
   $ git checkout -b @^
   fatal: '@^' is not a valid branch name
   hint: See 'git help check-ref-format'
   hint: Disable this message with "git config set advice.refSyntax false"

After creation, this branch cannot be checked out again, as `git checkout @` is a no-op. Luckily though, `git branch -d @` works, so I didn't permanently damage my Git repo :P

Bence

P.S. as I was typing this mail, I realized that I should've given `--branch` to check-ref-format, and sure enough, there's the problem:

   $ git check-ref-format --branch @
   @
   $ git check-ref-format --branch @{1}
   fatal: '@{1}' is not a valid branch name
   $

Not sure why it thinks that would be a valid branch name... IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

Next: D. Ben Knoble
Message 1 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.