> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-cloud/administering-sonarcloud/managing-organization/setting-config-at-org-level/setting-long-lived-branch-pattern.md).

# Setting long-lived branch pattern

This section explains how to define a long-lived branches name pattern in SonarQube Cloud at your organization level.

This feature is only available in the [Enterprise plan](https://www.sonarsource.com/plans-and-pricing/#sonarqube-cloud-features).

As an organization admin, you can set the long-lived branch name pattern at the organization level provided you have an Enterprise plan organization. The organization-level pattern applies by default to all projects. If the project admin sets a custom pattern for their project, this pattern overrides the organization’s pattern. See [Long-lived branch pattern](/sonarqube-cloud/managing-your-projects/project-analysis/long-lived-branch-pattern.md) for more information.

## Introduction to the long-lived branches name pattern <a href="#introduction" id="introduction"></a>

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.

{% hint style="info" %}
The type of a branch (long-lived or short-lived) is set during its first analysis and cannot be changed afterward.
{% endhint %}

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

If you don’t set any pattern at the organization level, the default pattern *`(branch|release)-.*`* applies.\* \*You can reset the organization pattern to this value.

## Setting a long-lived branches pattern for your organization <a href="#setting" id="setting"></a>

To set the long-lived branches pattern of your organization:

1. Retrieve your organization. See [Retrieving your organizations](/sonarqube-cloud/getting-started/viewing-organizations.md) for more details.
2. Go to **Administration** > **Organization settings.**
3. In **Branch** > **Long-lived branches detection**, enter your regular expression.
4. Select **Save**.

## Resetting the organization-level pattern to its default <a href="#reset-to-default" id="reset-to-default"></a>

1. Retrieve your organization. See [Retrieving your organizations](/sonarqube-cloud/getting-started/viewing-organizations.md) for more details.
2. Go to **Administration** > **Organization settings.**
3. In **Branch > Long-lived branches detection**, select reset. The pattern is reset to `(branch|release)-.*`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-cloud/administering-sonarcloud/managing-organization/setting-config-at-org-level/setting-long-lived-branch-pattern.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
