Replace main branch by another branch

We use a branch named production and would like to use it as the target branch for SonarCloud to scan. I configured the long-lived branch to Long-lived branches pattern: (branch|production|release).* but no where I can see the issue in production branch.

Hi,

Do you mean that you would like SonarCloud to treat it as your main branch?

You can’t change which branch is treated as the main branch in SonarCloud, so this is something that you’ll need to have handled at the project’s first analysis: analyze production without setting the branch name (so it will implicitly be taken as main) and then rename the branch to production.

 
HTH,
Ann

What about the long-lived branch? I wouldn’t seem to fully understand the benefit of it? I configured the pattern but my branch wasn’t shown in the Branches.

Hi,

It’s not clear to me what you expect.

Once you update your long-lived branch pattern, matching branches that are first analyzed after that will be treated as long-lived. Unfortunately, branch type is immutable, so branches that already existed in SonarCloud before you changed the pattern won’t have their types updated.

 
HTH,
Ann

What do you mean by “first analyzed”? Would you suggest that the main branch name should be changed to production?

Hi,

I mean the first time a given branch is analyzed.

That’s up to you.

 
HTH,
Ann