Hello, there is anyway to change the “default branch” for new projects ?
Every new project always start with a main/compare branch named “main”, but i really want it to start named as “develop”.
Why is that so important for us ?
Well, i know that we can rename one by one, but its not good for us, because we have A LOT of projects to import on sonar, and for that we need to make a first scan to create te project ( usually on the develop ), after that we need to delete that scan and change the “main” branch name to “develop”
Well, should be really good the “new code” policie also always start with “branch compare” and “develop” selected.
We are using SonarQube Enterprise Edition Version 10.1.
Welcome to the community!
I’ve moved this topic to the Product Manager for a Day category since the functionality you’re after doesn’t exist.
The best I can offer is what you’ve already discovered: analyze
develop without passing in a
sonar.branch.name and then rename it from
develop. In case it helps, that should be scriptable using the Web APIs (just use your browser dev tools to eavesdrop on a rename to see what call to make).
in case it helps, that should be scriptable using the Web APIs (just use your browser dev tools to eavesdrop on a rename to see what call to make).
Yes it may totally help!
(just use your browser dev tools to eavesdrop on a rename to see what call to make).
Some documentation should be great, but ok!
You may find this guide helpful.
If you create your project with the first analysis, your main branch in SonarQube effectively defaults to the name “main”.
However, starting from SonarQube 10.2, you don’t have to rename or delete your branch to make it the default. You can directly designate your develop branch as your main branch from the UI or the API.
If you consider automating it, you may want to look at this option.
Out of curiosity, are you also analyzing a branch named “main”? What makes you choose the “develop” branch as your main branch in SonarQube?