Re: git branch behavior after git init needs fixing
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".
> 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).