From: Junio C Hamano <gitster@pobox.com>
To: Ben Knoble <ben.knoble@gmail.com>
Cc: Ryan Johnson <ryan.johnson.code@gmail.com>, git@vger.kernel.org
Subject: Re: git branch behavior after git init needs fixing
Date: Mon, 09 Feb 2026 14:38:03 -0800 [thread overview]
Message-ID: <xmqqms1h35mc.fsf@gitster.g> (raw)
In-Reply-To: <xmqqjywl6e0w.fsf@gitster.g> (Junio C. Hamano's message of "Mon, 09 Feb 2026 09:08:15 -0800")
Junio C Hamano <gitster@pobox.com> writes:
> Ben Knoble <ben.knoble@gmail.com> writes:
>
>> You are probably looking for init.defaultBranch and the 3.0
>> breaking changes plan (which will make main the default).
>
> In other words, run
>
> $ git config --global init.defaultbranch main
>
> just once to live in the future? That sounds like a sensible
> suggestion to me.
And that is excatly what "git init" gives our users already, until
s/he sees it sufficiently often and declines to see it anymore, at
which point they are on their own ;-)
After temporarily disabling init.defaultBranch setting in my
configuration files (and I left advice.defaultBranchName setting to
the default), here is what I (or anybody) would get.
$ git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: will change to "main" in Git 3.0. To configure the initial branch name
hint: to use in all of your new repositories, which will suppress this warning,
hint: call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
hint:
hint: Disable this message with "git config set advice.defaultBranchName false"
Initialized empty Git repository in /var/tmp/x/.git/
prev parent reply other threads:[~2026-02-09 22:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-09 9:43 git branch behavior after git init needs fixing Ryan Johnson
2026-02-09 14:54 ` Ben Knoble
2026-02-09 17:08 ` Junio C Hamano
2026-02-09 22:38 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqms1h35mc.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=ryan.johnson.code@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox