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

Re: git branch behavior after git init needs fixing

From
Ben Knoble <ben.knoble@gmail.com>
Date
Feb 9, 2026, 14:54 UTC
Message-ID
<D1CA4E13-B279-4931-81EF-364169564612@gmail.com>
In-Reply-To
<DS0PR03MB72900848B03D2B87A6846DCAA365A@DS0PR03MB7290.namprd03.prod.outlook.com>
Show 5 quoted lines
> Le 9 févr. 2026 à 04:43, Ryan Johnson <ryan.johnson.code@gmail.com> a écrit :
> 
> Immediately after running `git init`, Git's `git branch` output is empty.
> 
> This is problematic because this implies that there is no default branch. I am told that there is a subtle distinction between an already-created branch and a "promise" to create a branch upon git init. The "promise" of a branch is not exposed, when it should be in the `git branch`command.
I believe this is called an « unborn » or « orphan » branch (see « git help switch » for example).
> Hiding the default branch name from git branch is inconsistent with the information reported by other commands like `git status` and clashes with the availability of branch operations. `git status` reports that the repository is "On branch master".
[no comment from me]
> A typical user will need to rename their branch from master to main to conform with modern standards, so having no branch shown is confusing and quite frankly wrong.
You are probably looking for init.defaultBranch and the 3.0 breaking changes plan (which will make main the default).
Previous: Ryan JohnsonNext: Junio C Hamano
Message 2 of 4 in “git branch behavior after git init needs fixing”
  1. Ryan JohnsonFeb 9, 2026
  2. Ben KnobleFeb 9, 2026
  3. Junio C HamanoFeb 9, 2026
  4. Junio C HamanoFeb 9, 2026

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.