Rename branch ‘Master’ to ‘Main’ in Azure DevOps

In Azure DevOps whenever we create a new repo, the default branch name would be ‘Main’. Previously default branch name would be ‘Master’. In the below post let us see how to change the branch name of older repos from ‘Master’ to ‘Main’. Before following the below steps you may to consider downstream impacts about this as it might impact Pipelines, Existing Pull Requests, Existing Clones, Incoming links etc., There is no direct way to rename a branch in Azure DevOps but there is an alternate method which involves deleting a branch & renaming it.

Step 1: Go to Azure DevOps Project & Click on Repos

Step 2: Choose the Repo in which the branch name needs to be changed

Step 3: Click on branches

Step 4: Click on 3 dots next to master & then click on New branch



Step 5: Type “Main” as shown below & then click on Create button.

Step 6: Now set ‘Main’ as default branch and then delete the ‘Master’ branch. Also once these changes are done make sure that all the pull request settings, linked pipelines are updated with the ‘Main’ branch name, if not done then it might seriously affect the pipelines.

You may also like...