Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
Rename “master” to “main” in our repositories¶
In some repositories the default branch is still called master
while in
other repositories it is called main
. That’s because Lino started long
before 2021 (when the Git community decided to change “master” to “main”, read
e.g. The new Git default branch name).
But we are working on for #5597 (Rename “master” to “main” in our repositories). Inspired by this and maybe this.
(1) Agree with other contributors regarding the date and time for this.
(2) Make sure that your local copy is clean:
$ go lino
$ git status
$ git checkout master
(3) Rename the existing default branch to the new name (main). The argument -m transfers all commit history to the new branch:
$ git branch -m master main
(4) Push the newly created main branch upstream, and set your local branch to track the remote branch with the same name:
$ git push -u origin main
(5) Change the project’s default branch on the GitLab website:
Select Settings > Repository. Expand Branch defaults. For Default branch, select a new default branch. Full instructions see here.
(6) Notify your project contributors of this change, because they must also take some steps:
Contributors should pull the new default branch to their local copy of the repository.
Contributors with open merge requests that target the old default branch should manually re-point the merge requests to use main instead.
(7) Optionally tell your computer to use “main” and not “master” as default branch name for new repositories:
git config --global init.defaultBranch main