Renaming Git's Master Branch


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:

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:

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:

GitHub Create Branch

If you have any open pull requests, you'll need to edit them and switch the base branch to main:

GitHub Change Pull Request Base Branch

You can find a link to change the default branch on the "branches" page of your repo:

GitHub Change Default Branch

You can create a new branch in Bitbucket here:

Bitbucket Create Branch

Pull Request target branch will need to be changed here:

Bitbucket Update Pull Requests

The main branch can be updated under the repository's settings:

Bitbucket Change Main Branch
Azure Devops

In Azure DevOps you can create here:

Azure DevOps Create Branch

You can then change the default branch here:

Azure DevOps Set Default Branch

The End

That's all there is to it!