How to change the main branch in SonarQube?

Hello @Scott_Chapman ,

Yes it is.

It depends of which of the options you chose to define the new code on your mainbranch, but sometimes yes.

  • If new code is defined as previous version, yes. If you want to work around this side effect, you could analyze the main branch based on a tag that corresponds to the previous version (to set the baseline of the new code first), and then analyze the head of the branch (to set the new code)
  • If new code is defined as number of days, no. This is solely based on commit dates
  • If new code is based on reference branch, no. The diff between the reference branch and current branch
  • If new code is based on specific analysis, yes. Just the for previous version, if you want to workaround this side effect, you could analyze the main branch based on a commit that corresponds to the specific analysis that should mark the beginning of the new code and (to set the baseline of the new code first), and then analyze the head of the branch (to set the new code)

Olivier

1 Like