How to "Rename" the Master Branch to Main in Git in Azure DevOps

on June 26, 2020

I believe that language matters, and that it is worth our effort to move away from language associated with slavery and racism whenever possible.

Azure DevOps doesn’t technically allow you to rename branches– but you can work around the issue by creating a new branch from master, setting the new branch as the default branch, and deleting the master branch. Here’s the Microsoft documentation on this topic.

In this video, I create a new default branch named main, then update a pipeline dependent on the default branch name.

Note: if you’re using Git in something else like GitHub, you can do this in a simpler way.