How to change the default branch in a project

Version: 9.9
We have a project in SonarQube where we analyze 6 branches. The project is set up locally. Currently, the default branch is set as a branch called ‘main’ which has not been analyzed yet. I want to change the default branch to ‘master’. Please let me know how I can achieve this requirement.

Hi,

Are you saying you want to rename main to master? That can be accomplished in Project Settings → Branches & Pull Requests in the row’s dots menu.

Or would you like to swap which branch is main? For that you’ll need to upgrade to 10.5

 
HTH,
Ann

I’d like to swap the main branch. Currently our company is using 9.9. Is the only way to accomplish this here is to rebuild the project?

Hi,

Since your main has not been analyzed yet, you can analyze master without passing in the branch name. It will be analyzed as the main branch. You can then rename it to master if you like.

And I believe there’s a global setting for what branch name should be the main branch.

 
HTH,
Ann

This is actually for an integration, namely the Jira integration, it picks up only the default branches from the projects. So currently it’s shown as project not analysed yet as the plugin only detects the main branch, which is the default. I’m looking to change it to master so that the integration works