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
It seems that most people are settling on
main as the replacement for
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
- Create a new branch called
mainand make sure it is based off of
- If you have any CI setup on
master, switch it over to
mainas your main/default branch
- Locally run
git pullfollowed by
git checkout main
Below are some screenshots and specific details of the three platforms I use:
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
You can find a link to change the default branch on the "branches" page of your repo:
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:
In Azure DevOps you can create here:
You can then change the default branch here:
That's all there is to it!