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

Re: Regarding Git and Branch Naming

From
Chris Torek <chris.torek@gmail.com>
Date
Jun 26, 2020, 18:33 UTC
Message-ID
<CAPx1GvcZk2o7f8-27xokwxUayWwO+t5qdsMjLrjBymc+WHznmw@mail.gmail.com>
In-Reply-To
<B4814F42-7AF8-4D80-93D4-FAF752C72F21@me.com>
On Fri, Jun 26, 2020 at 10:19 AM Craig H Maynard <chmaynard@me.com> wrote:
> Does the git init command really need to create a default branch? Perhaps that step could be left to the user.

The HEAD pseudo-ref must exist and must contain a valid OID or branch name. (If it does not exist, Git says that the directory is not a repository. Perhaps this test could be weakened, but that's definitely a fairly big change.)

In a new, empty repository there are no valid OIDs, so HEAD must contain a branch name. The branch itself need not exist, but whatever name is in HEAD is the branch that will be created when the user makes the first commit.

Chris
Previous: Craig H MaynardNext: Jeff King
Message 2 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.