Change Azure Repos Default Branch

Davide 'CoderDave' Benvegnù - Nov 6 '20 - - Dev Community

Azure Repos now offers a customizable default branch name for Git which can be set per project or per organization.

Today we talk about the default branch name in Azure Repos and how to change it. Let's see how.

Video

If you are a visual learner, or simply prefer to watch and listen instead of reading, here you have the video with the whole explanation and demo, which to be fair is much more complete than this post.

(Link to the video: https://youtu.be/zoTnQRyt6pM)

If you rather prefer reading, well... let's just continue :)

Intro

To change the default branch name for new repositories you have 2 options: you can do it either at project-level or at organization-level.

Change at Project Level

To change it at project level, you need to go into Project Settings > Repositories > Settings

Prj level settings

Remember that this will set the new default branch name only on newly created repos inside this project.

If you want to change the default branch for an existing repo, just go to:

Repos > Branches > Create or select a branch > ... > Set as default

Watch the video for the full example

This is good, but if you have many projects in your Azure DevOps organization it will take you forever to change this. This is where the new org-level settings comes in help.

Change at Organization Level

To change the default branch name for new repositories at org level go into Org Settings > Repositories > Settings

Org level settings

Now all your new repos will have the default branch name as you set here.

You can still change the name at project level if you want, and that will override the setting at organization-level.

Watch the video for the full example

Conclusion

Let me know in the comment section below what is your default branch name of choice.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .