Rename master branch to main branch

I’m quite new to sonarcloud.io.

I have a project where I renamed my master branch to main in bitbucket.

But In sonarcloud, I don’t see how to change the MAIN BRANCH.
How can I achieve it? should I remove the project and reimport it?

Thanks for your help
Thierry

1 Like

Hi @Thierry_Paret welcome to the community,

In the Administration → Branches and Pull Request (old UI), or Branches (new UI) you can rename the branch by clicking either on the “3-dots” or on the wheel button on the right of the branch, you’ll have the option to rename it.

HTH,
Mickaël

I have manage my branches in bitbucket… I don’t have anymore a master branch… but a main branch now

Meaning that you have both master and main branch on SonarCloud ? Or did i misunderstand ?

No on Bitbucket, I only have a main branch now.
But In sonarcloud, I see both.

Can you share a screenshot of how it looks on SonarCloud please ?

My branches on bitbucket :

Is you project bound to your bitbucket repository ?

yes it should be

You can be sure by checking if you have the bitbucket logo beside your organization or your project.

If it’s bound, then normally the default branch should be rename automatically upon a new analysis on it.

What does say the logs when you analyze your main branch ? Do you have any kind of error ?

Yes the project is bound to bitbucket

The main branch appears as a normal branch

don’t know how to access the log.

Do you have other branches / pull request that targets the master branch on SonarCloud ? If no, i think you can simply delete it, and try again a new analysis of the main branch to see if it recognizes that this is the default branch.

So I deleted the project and recreated it and it’s ok Now
Thanks

Well i meant you can delete the branch itself, not the whole project, but that’s a solution, and glad it works now :smiley:

Mickaël

Yes the usual “Turn it off and on again” like Roy and Moss would say :wink:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.