Re: git tag -a HEAD leads to ambiguous branch name
- From
Jeff King <peff@peff.net>
- Date
- Nov 27, 2024, 14:27 UTC
- Message-ID
- <20241127142711.GB1712@coredump.intra.peff.net>
- In-Reply-To
- <47cdf937-6192-4c83-a0e5-700e98f36c1e@jowil.de>
On Wed, Nov 27, 2024 at 01:14:23AM +0100, git@jowil.de wrote:
Show 10 quoted lines
> today I encountered a warning using git version 2.39.0.windows.2: > /warning: refname 'HEAD' is ambiguous./ > It turned out, having written > /git tag -a HEAD -m "Some message."/ > was the culprit. > As > /git branch HEAD/ > yields the following error > /fatal: 'HEAD' is not a valid branch name/ > I wanted to aks, whether a similar check should be applied to tag names.
Yes, I think that's reasonable. We won't ever completely forbid "HEAD" as a branch or tag name for historical reasons. But when porcelain like git-branch or git-tag sees it, it is almost certainly a typo or forgotten argument.
-Peff