[DEPRECATED] Follow this doc to migrate a repo's default branch from master
to main
.
Due to the negative meaning of master
we are standardising on main
.
This is a small step to make working here more inclusive for those who feel excluded by this term. Although there is a small hassle in changing this, it is far less than the difficulties experienced by underrepresented groups in tech. By doing this small work, this can encourage us to remember inclusivity as part of all our work.
For more background on this terminology, see Changing terminology to be more descriptive and more inclusive.
For more about inclusive language see Words Matter doc at the manager’s guide.
Overall the process is:
- Update GitHub
- Update CI (typically TeamCity)
- Update CD (typically RiffRaff)
- Update Snyk
- Perform a deploy to ensure everything is still working
- Inform your team to update their clone
The master-to-main
script automates the GitHub phase and will create issues in your repo for the remaining steps to act as a checklist/reminder for you.
That is, run npx @guardian/master-to-main
and 🎉.
The steps we go through have been inspired by this doc.
master-to-main
will also scan your repo for the word master
and create an issue linking to them for you to update.
-
Check branch filter in teamcity to make sure no special build for the default branch.
-
Edit VCS root default branch (TeamCity docs on VCS can be found here).
Find project -> Edit Configuration -> Version Control Settings -> Edit -> General Settings -> Default branch
-
Check build steps for hard coded branch name.
Find project -> Edit Configuration -> Build Steps
-
Update the
snyk monitor
build step's Main branch to usemain
.
You'll need to update RiffRaff to look at your new default branch. There will be an issue created in your repo with more details.
Change snyk GitHub integration(s) - it uses the default branch, but you will need to delete and re-import the project+file as this is the only way to refresh the default branch at present.
Create a small change and merge it.
RiffRaff should pick it up as normal. If enabled, a continuous deploy should also be triggered from the new default branch.
Anyone who has a local clone of the repo would need to run the following to move to main
:
git fetch --all
git remote set-head origin -a
git branch --set-upstream-to origin/main
git branch -m master main