Many communities on GitHub are considering renaming the default branch name of their repository from master, as this terminology can be offensive. Statements and guidance have been published by Git here and GitHub here.
New GitHub repositories use main as the name for the default branch, so it makes sense that we should follow this convention, as well as matching what other teams within GDS are doing so we are consistent.
Additional Info
GitHub have made it easier for teams to rename branches. When we rename the branch, we get the following for "free" without having to do anything ourselves:
Open PRs and branch protection rules changed automatically
Web requests for the old branch name are redirected to the new branch name
API requests for the old branch name return a Moved Permanently response
A notice is shown on the repository homepage to notify contributors, maintainers and admins to update their local copies of the repo
A notice is shown to contributors who git push to the old branch
Who needs to know about this
Developers
Steps to follow
[x] Raise PR to switch functionality that relies on master and to update any documentation
[x] Once the PR has been approved (not merged!), rename the master branch to main in the Github UI
[x] Double check branch protection rules
[x] Double check webhooks
[x] Double check any deploy systems, e.g: GitHub pages, that may have it's own config
[x] If the repo uses Travis: Travis has its own idea of what the 'default branch' is which is synced once a day. You can manually trigger a sync by going to https://travis-ci.com/account/repositories and pressing 'sync account'.
[x] Merge the PR
[x] Check everything is still working as expected, e.g: build and deploy. If so, double check there is a main branch present and no old master branch present.
Done when
[x] The default branch is named main
[x] Documentation has been updated to refer to main rather than master
[x] Check GitHub pages settings to ensure it's deploying from main branch
What
Rename the default branch from
master
tomain
.Why
Many communities on GitHub are considering renaming the default branch name of their repository from master, as this terminology can be offensive. Statements and guidance have been published by Git here and GitHub here.
New GitHub repositories use
main
as the name for the default branch, so it makes sense that we should follow this convention, as well as matching what other teams within GDS are doing so we are consistent.Additional Info
GitHub have made it easier for teams to rename branches. When we rename the branch, we get the following for "free" without having to do anything ourselves:
git push
to the old branchWho needs to know about this
Developers
Steps to follow
master
and to update any documentationmaster
branch tomain
in the Github UIDone when
main
main
rather thanmaster
main
branch