Default branch is always detected as master when the long‑lived branch is the default branch

Hello SonarCloud Community,

I’m encountering an issue with default branch handling in SonarCloud when analyzing new projects.

Problem description

  • When I analyze a long‑lived branch that is also the repository’s default branch (for example main or develop), SonarCloud always assigns it the name master, ignoring the actual branch name.

  • This behavior happens only when the long‑lived branch is the default branch.

  • If the long‑lived branch is not the default branch, SonarCloud correctly shows the actual branch name.

Impact

Because of this:

  • main or develop is renamed to master inside SonarCloud

  • All analysis results are attached to master

  • The real branch name is lost

  • In some cases, analysis data or code appears to be missing

  • The branch structure in SonarCloud does not match the repository

Expected behavior

  • If the default branch is main or develop, SonarCloud should:

    • Detect and use the correct default branch name

    • Keep all analysis and code associated with that branch

    • Avoid renaming it to master

Actual behavior

  • When the default branch is analyzed as a long‑lived branch, it is always shown as master

  • Only non‑default long‑lived branches keep their real names

Goal

I want the default branch and all long‑lived branches to appear in SonarCloud with their real names, including all related code and analysis.

Is this expected behavior, a configuration issue, or a known limitation?
Any guidance would be appreciated.

Thank you!

Hi,

Let’s call this a known limitation. After branch creation, you can rename it on the project’s Branches page.

 
Ann

Hi Ann,

i understand. Thank you we will rename the default Branch then.

BR,
Mostafa