From: "Bence Csókás" <bence.csokas@arm.com>
To: git@vger.kernel.org
Subject: [Bug] Porcelain allows creation of '@' branch
Date: Mon, 31 Aug 2026 16:22:43 +0200 [thread overview]
Message-ID: <4e8d8b75-ddf4-4602-a2a8-26e5214c65f0@arm.com> (raw)
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 reply other threads:[~2026-08-31 14:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 14:22 Bence Csókás [this message]
2026-08-31 19:59 ` [Bug] Porcelain allows creation of '@' branch D. Ben Knoble
2026-09-02 7:37 ` Jeff King
2026-09-03 8:38 ` Kristoffer Haugsbakk
2026-09-03 12:35 ` Bence Csókás
2026-09-03 15:14 ` Ben Knoble
2026-09-03 18:45 ` Junio C Hamano
2026-09-06 7:56 ` Kristoffer Haugsbakk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4e8d8b75-ddf4-4602-a2a8-26e5214c65f0@arm.com \
--to=bence.csokas@arm.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.