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

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
Previous: Philip OakleyNext: Elijah Newren
Message 7 of 9 in “Re: Regarding Git and Branch Naming”
  1. Craig H MaynardJun 26, 2020
  2. Chris TorekJun 26, 2020
  3. Jeff KingJun 26, 2020
  4. Junio C HamanoJun 26, 2020
  5. Jeff KingJun 27, 2020
  6. Philip OakleyJun 26, 2020
  7. Jeff KingJun 27, 2020
  8. Elijah NewrenJun 26, 2020
  9. Jeff KingJun 27, 2020

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.