]> git.ipfire.org Git - thirdparty/git.git/commit
breaking-changes: switch default branch to main
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Wed, 10 Sep 2025 15:29:00 +0000 (16:29 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 10 Sep 2025 20:34:58 +0000 (13:34 -0700)
commit67d9b39cc711468c381f070e241211895fe97136
tree41146a3b2492f0dc1870f2da7b2d07d46183d822
parent2462961280690837670d997bde64bd4ebf8ae66d
breaking-changes: switch default branch to main

Since 1296cbe4b46 (init: document `init.defaultBranch` better,
2020-12-11) "git-init.adoc" has advertised that the default name
of the initial branch may change in the future. The name "main"
is chosen to match the default used by the big Git forge web sites.

The advice printed when init.defaultBranch is not set is updated
to say that the default will change to "main" in Git 3.0. Building
with WITH_BREAKING_CHANGES enabled removes the advice and changes
the default branch name to "main". The code in guess_remote_head()
that looks for "refs/heads/master" is left unchanged as that is only
called when the remote server does not support the symref capability
in the v0 protocol or the symref extension to the ls-refs list in the
v2 protocol. Such an old server is more likely to be using "master"
as the default branch name.

With the exception of the "git-init.adoc" the documentation is left
unchanged. I had hoped to parameterize the name of the default branch
by using an asciidoc attribute. Unfortunately attribute expansion
is inhibited by backticks and we use backticks to mark up ref names
so that idea does not work. As the changes to git-init.adoc show
inserting ifdef's around each instance of the branch name "master"
is cumbersome and makes the documentation sources harder to read.

Apart from "git-init.adoc" there are some other files where "master" is
used as the name of the initial branch rather than as an example of a
branch name such as "user-manual.adoc" and "gitcore-tutorial.adoc". The
name appears a lot in those so updating it with ifdef's is not really
practical. We can update that document in the 3.0 release cycle. The
other documentation where master is used as an example branch name
can be gradually converted over time.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/BreakingChanges.adoc
Documentation/git-init.adoc
advice.c
advice.h
ci/run-build-and-tests.sh
refs.c
t/t0001-init.sh
t/test-lib.sh