Re: Regarding Git and Branch Naming
- From
Jeff King <peff@peff.net>
- Date
- Jun 27, 2020, 03:11 UTC
- Message-ID
- <20200627031111.GB1187031@coredump.intra.peff.net>
- In-Reply-To
- <6b9d76e4-68dd-8e57-f96a-318579dea6f3@iee.email>
On Fri, Jun 26, 2020 at 10:33:14PM +0100, Philip Oakley wrote:
> A wild bikeshed question: Is HEAD itself protected as a branch name e.g. > that HEAD could contain `ref: HEAD` or `ref: refs/heads/HEAD`? (or maybe > the null oid
The first is not legal; we insist that symrefs start with "refs/". The second one _is_ legal, but isn't any kind of loop. The HEAD symref is .git/HEAD, which is distinct from a ref of the same name inside refs/heads/.
It's confusing, of course, because the lookup rules make it hard to refer to refs/heads/HEAD. For that reason we do disallow it from the branch-creation porcelains like git-branch and git-checkout.
-Peff