Creating a branch and compare against master

We are using the Developer Edition and I am tasked with integrating branch analysis.

Our workflow is simple: we have the master branch which is the stable branch. For each change, a new branch is created. These are (usually) short-lived. We now run sonar-scanner on that branch with set to the branch’s name (e.g. sonar-scanner This results in SonarQube showing an additional branch in the web interface.

However, that branch does not show / analyze the delta to the master branch (I even tried explicitly giving I seem to be only able to analyze updates within that branch, but can not trigger a delta analysis to the master branch.


INFO: SonarQube Scanner
INFO: SonarQube server 8.1.0

  • git checkout -b task123
  • <edit a source file, e.g. add int i, j; in a .cpp>
  • git commit -a . -m “test”
  • sonar-scanner
    -> This results in a branch task123 on SonarQube, but no “New Code” is shown
  • run again: sonar-scanner
    -> This now shows New Code, but with everything 0.
  • <edit a source file, e.g. extend to int i, j, k; in a .cpp>
  • git commit -a . -m “test2”
  • sonar-scanner
    -> This now shows New Code, and adds the code smell for variable k.

What I would expect is a “New code” compared against master branch on first submission (in this case, complaining about i, j and k variables being in the same line and not const, for example)


is not relevant anymore for Sonarqube 8.1
We have related problems, see



1 Like

Thanks, Gilbert. That’s exactly the situation I have. I guess I will follow your threads (already voted for the request) and hope that they are going to fix it.

I met the same demand as you, how can I achieve it?

@xiaoweiFive, see the linked threads.

Basically I am not scanning the branches as branches anymore, but as pull-requests.

I need to pull-request every time I submit the code, or do I use sonar to create pull-requests?
please help me

hi, Link is error! :joy: