0005: Change Default Git Branch to main¶
Date proposed: 2025-08-18
Discussion: https://gitlab.postmarketos.org/postmarketOS/pmcr/-/merge_requests/9
Summary¶
This proposal outlines a plan to shift the default git branch for project
repositories from master to main. This is following a broad shift
being done within the wider FOSS community.
Motivation¶
Currently, the default git branch in our repositories is generally master.
This is an unfortunate name left over from git’s inspiration Bitkeeper.
Bitkeeper had “master” and “slave” repositories, with the “master” repository
making up the source of truth for the source code. This naming scheme is
unfortunate at best, as it directly relates software development to the
power dynamic, horrors, and institution of slavery. While not everybody
relates the word master to slavery due to cultural and historical
differences, we aim to be an inclusive community. Such wording should
not have a space when it has clearly unacceptable background for various
groups of people.
GitHub,
GitLab,
and Forgejo have
switched to using main as the default branch of new repositories, along with
sourcehut
containing direct documentation referencing the switch. As such, it is obvious
that the direction that the FOSS communities are going is towards main, and
we should follow suit.
Consequences¶
Users should not see any outward changes, as this will only affect handling project repositories through git, which will not propagate to usage.
Contributors will have to relearn muscle memory when dealing with project
repositories. Along with this, existing merge requests targeting the master
branch will have to be recreated to target the main branch instead as GitLab
does not have a way to change the target branch after MR creation.
Maintainers will have to ensure that new MRs are sent to the correct branch
while the master branch still exists during transition and also ensure that
any new code does not hard-code the master branch. Maintainers of non-critical
repositories that are not stated in the implementation plan shall move their
projects to main within one month after the acceptance of this MR, with GitLab
admins moving the default branch if the deadline is not met.
Projects will have to be updated to ensure that they do not hard-code the
master branch anywhere.
Implementation plan¶
Identify every instance of hard-coded
masterin our repositories and place them in an issue under the organizational repository.This step also includes modifying wiki references to
master, but that can be done asynchronously as projects are updated to usemain.
Create MRs to repositories that hard-code
master, changing the string tomain. Do not merge these yet, as they will all have to be merged at once to prevent breakages.Create an MR to pmbootstrap to add a script to migrate the pmaports work folder created by pmbootstrap from
mastertomain.Test changing the default branch of a small repository with few open MRs from
mastertomain. A good candidate for this is one of our repositories implementing a versioned program, such as tinydm. Using a repo with tags allows us to safely move the default branch frommastertomainwithout breaking builds.Changing from
mastertomainwill be done by branchingmainfrommaster, pushing it, and setting it as default. Then, push a commit tomasterstating its depreciation in the README, and pointing to themainbranch.
Ask maintainers of all projects except bpo, pmbootstrap, pmaports, and ci-common to move the default branch to
main. A script will be provided to simplify the work.Release an edge blog post stating our plans to move the default branches of essential repositories to
main.For ci-common:
Branch
mainfrommaster.Merge MRs that change the branch to pull for ci-common from
mastertomain.On
master, edit theinstall_pmbootstrap.shscript to print a deprecation error and exit1. Delete all other files except the license and the README and add a deprecation notice pointing tomainto it.
For pmbootstrap:
Branch
mainfrommaster.Merge MRs that change the branch to pull for pmbootstrap from
mastertomain.On
master, add a commit deleting all files except the license, the README, and the branch migration script. Add a deprecation notice pointing tomainto the README.Release a new version.
For bpo / https://mirror.postmarketos.org:
Shutdown.
Move
mastertomainSymlink
masterto point tomain.Start.
Do the following at the same time:
Shutdown bpo.
In pmaports, bump
pmbootstrap_min_versionto the new pmbootstrap release.Branch
mainfrommasterin pmaports.Adjust
channels.cfgin pmaports.Delete all files except for the license and README in the
masterbranch of pmaports and point to themainbranch in a depreciation notice in the README.Merge MRs that fix hard-coding the
masterbranch of pmaports.In bpo, replace “master” with “main” in the database.
In bpo, adjust the config to build from
mainin pmaports.Adjust https://pkgs.postmarketos.org/ to point to
main.
Once the move is verified working, backport any patches to branch hardcoding that effect earlier supported versions of postmarketOS.
The proposer¶
This proposal was written by Aster Boese (@JustSoup321), with help in the implementation plan from Oliver Smith (@ollieparanoid).
Blocking issues¶
None not listed in the implementation plan.