Today I spent about an hour renaming the master
branch to main
on all my personal repositories.
This included around 100 repos in GitHub, Bitbucket and Azure DevOps.
To be clear, I don't think this is going to be the thing that fixes racism in our society.
I've heard people (mostly on Twitter) argue against this change, however:
- If we're going to argue over such small things, what hope is there to get anything big done?
- If the word "master" hurts even just a few people, then this change is worth my time.
- If this change brings even a little more awareness, it's worth my time.
How to Change master
to main
It seems that most people are settling on main
as the replacement for master
.
If you'd like to make such changes to your repositories, the general steps are:
- Make sure that any local changes have been pushed to
master
- Create a new branch called
main
and make sure it is based off ofmaster
- If you have any CI setup on
master
, switch it over tomain
- Configure
main
as your main/default branch - Delete
master
- Locally run
git pull
followed bygit checkout main
Below are some screenshots and specific details of the three platforms I use:
GitHub
You can create a new branch in Github directly on the main "code" page of the repo:
If you have any open pull requests, you'll need to edit them and switch the base branch to main
:
You can find a link to change the default branch on the "branches" page of your repo:
Bitbucket
You can create a new branch in Bitbucket here:
Pull Request target branch will need to be changed here:
The main branch can be updated under the repository's settings:
Azure Devops
In Azure DevOps you can create here:
You can then change the default branch here:
The End
That's all there is to it!