Changing default MAIN BRANCH in sonarcloud

Hi,

In our project, “dev” is showing up as the MAIN branch (long lived) but there is no “dev” branch in our repository. We would like to make another branch say “dev-80” as our main branch. However, we are unable to find out a way to make this change. On the three dots on the “dev” branch, there is only one option “Rename” but I am not sure if this would really achieve our desired change.

Please suggest.

Thanks

Hi,

Unfortunately, it’s not possible to change which branch is treated as the main branch. To make “dev-80” the main branch, you would have to delete the project and re-create it.

 
:slightly_frowning_face:
Ann

Thanks. But what is the “dev” branch that shows up as “Main Branch” in our view. As mentioned earlier there is no “dev” branch in our project and hence unable to fully grasp what this might be.

Hi,

At this point, I’m a bit confused. Can you share a screenshot?

 
Ann

Sure. As shown in the screenshot, “dev” is being considered as MAIN BRANCH even though I have no branch in my AzDo called “dev”

Furthermore, sha id e8cff777 is on my short lived feature branch and which hasn’t yet been merged to any other branch yet.

So, I am still unable to understand the “dev” branch and why it is being taken as the “MAIN BRANCH”

Hi,

If you analyze without specifying the branch name, the analysis is counted as being against/of the main branch, whatever that is. Without access to your analysis logs, I can only guess that’s what happened here.

 
Ann

ah ok. that may explain why it was fine and reported properly against the correct short lived branch until I ran sonar-scanner.bat locally on the short lived branch rather than on AzDo. Thanks

That still does not help solve the mystery around “dev” branch though.

Hi,

So the original question:

I can only guess that someone renamed the main branch to dev at some point via the UI.

 
Ann