Long-lived branch pattern

This page explains how to define a long-lived branch name pattern in SonarQube Cloud, at the project level.

SonarQube Cloud considers a branch to be long-lived if:

  • It is the main branch, or

  • Its name matches the long-lived branch name pattern.

All other branches are considered short-lived.

circle-exclamation

If your project belongs to an organization, its long-lived branch name pattern is by default the pattern set at the organization level. You can change it.

The name pattern is based on a regular expression. For example, the regular expression: (branch|release)-.* matches any name that begins with the string branch- or release-.

chevron-rightChanging the long-lived branch pattern of your projecthashtag
  1. Retrieve your project. See Retrieving projects for more details.

  2. Go to Branches.

  3. In the top-right corner, select the edit icon on the right of Long-lived branches pattern. The Detection of long-lived branches dialog opens as illustrated below.

  4. Enter your regular expression.

  5. Select Save.

Detection of a long-lived branch
chevron-rightResetting the long-lived branch pattern to defaulthashtag

If your project belongs to an Enterprise plan organization, you may want to reset the long-lived branch to the default set at the organization level. To do so:

  1. Retrieve your project. See Retrieving projects for more details.

  2. Go to Branches.

  3. In the top-right corner, select the edit icon on the right of Long-lived branches pattern. The Detection of long-lived branches dialog opens.

  4. Select Reset to default.

Last updated

Was this helpful?