Closed
Description
What
Rename the default branch from master
to main
.
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:
- 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
- Raise PR to switch functionality that relies on
master
and to update any documentation - Once the PR has been approved (not merged!), rename the
master
branch tomain
in the Github UI - Double check branch protection rules
- Double check webhooks
- Double check any deploy systems, e.g: GitHub pages, that may have it's own config
- Merge the PR
- 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
- The default branch is named
main
- Documentation has been updated to refer to
main
rather thanmaster
- Check GitHub pages settings to ensure it's deploying from
main
branch - Check local setups still work
Metadata
Metadata
Assignees
Labels
No labels