SonarCloud | Managing your projects | Administering your project | Setting up project analysis | Long-lived branch pattern
Adjusting the long-lived branch name pattern of your project
Defining the long-lived branch name pattern at project level
SonarCloud 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.
The type of a branch (long-lived or short-lived) is set during its first analysis and cannot be changed afterward.
If your project belongs to an Enterprise plan 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-
.
Changing the long-lived branch pattern of your project
- Retrieve the project.
- In the left navigation bar, select Branches.
- 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 (in the case of an enterprise plan organization).
- Enter your regular expression.
- Select Save.
Resetting the long-lived branch pattern to default
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:
- Retrieve the project.
- In the left navigation bar, select Branches.
- 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.
- Select Reset to default.
Was this page helpful?