> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coderabbit.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Choose the configuration branch

> Learn which branch CodeRabbit reads the repository configuration file from, and on GitHub Cloud pin it to the default branch or a branch you name.

CodeRabbit reads the repository configuration file from a specific revision for every review. By default, a trusted pull request is reviewed with the file on its own branch. On GitHub Cloud, you can change this with the **Configuration source** setting.

## How Auto picks the file

**Auto** is the default on every Git provider.

| Pull request | CodeRabbit reads the file from |
| - | - |
| From a branch in the same repository, opened by a [trusted](#who-counts-as-trusted) author | The pull request head |
| From a fork | The pull request's base commit |
| From a branch in the same repository, opened by an author who isn't trusted | The pull request's base commit |
| Trust can't be checked | The pull request's base commit |

So a trusted pull request that adds or changes `.coderabbit.yaml` is reviewed with that change before it merges. The change affects only that pull request; other pull requests keep their configuration until it merges. The base commit can be older than the current tip of the target branch.

### Who counts as trusted

A pull request from a fork is never trusted. For other pull requests, each Git provider decides trust from what it knows about the author:

| Git provider | A pull request is trusted when its author |
| - | - |
| GitHub and GitHub Enterprise Server | Is an owner, organization member or collaborator, or has Admin, Maintain or Write permission on the repository |
| GitLab | Has the Owner, Maintainer or Developer role in the project, directly or through a group |
| Azure DevOps | Opened it from a branch in the same repository |
| Bitbucket Cloud and Bitbucket Data Center | Opened it from a branch in the same repository |

Azure DevOps and Bitbucket have no author roles to check. A branch in the repository can only be pushed by someone with write access, so CodeRabbit trusts every pull request that isn't from a fork.

## Choose a configuration source

> [!NOTE]
>
> **Configuration source** is available only for GitHub Cloud repositories on CodeRabbit Cloud. GitLab, Bitbucket, Azure DevOps, GitHub Enterprise Server and self-hosted CodeRabbit always use **Auto**.

| Source | Reads the file from | Can a pull request change it? | Use it when |
| - | - | - | - |
| **Auto** | The pull request head for trusted pull requests, otherwise the base commit | Yes, trusted pull requests | You want the standard behavior |
| **Default branch** | The latest commit on the default branch | Only trusted pull requests that change the configuration file, while **Allow configuration changes from trusted PRs** is on | Merged changes must reach open pull requests without a rebase |
| **Custom** | The latest commit on a branch you name in the same repository | No | Configuration lives on a dedicated branch that pull requests can't override |

**Custom** reads `.coderabbit.yaml` or `.coderabbit.yml` at the root of the named branch.

**1. Open the repository's settings**

Go to **Review** > **Review settings** and select one repository.

**2. Open Configuration source**

Select **Configuration source** in the settings index.

**3. Choose a source and save**

Choose **Auto**, **Default branch** or **Custom**, enter a branch name for **Custom**, and select **Save changes**.

Only organization admins can change the source. Other members who can open the repository's settings can view it. CodeRabbit stores the choice, not your configuration file.

## Allow configuration changes from trusted pull requests

With **Default branch**, **Allow configuration changes from trusted PRs** is on by default. When a trusted pull request adds, edits, deletes or renames the configuration file, CodeRabbit reviews it with the pull request's file. Fork and external-contributor pull requests still use the default branch.

> [!WARNING]
>
> An older configuration file that a branch inherited when it was created isn't a change. With **Default branch**, CodeRabbit ignores it and reads the default branch.

## Compare the sources on one pull request

The `feature/search` branch was created from `main` last month, when `.coderabbit.yaml` set `language: es-ES`. Since then, `main` changed it to `en-US`, and a `review-config` branch sets `fr-FR`. The pull request changes only code.

| Source | Review language | Why |
| - | - | - |
| **Auto** | Spanish | Reads the file on the pull request branch |
| **Default branch** | English | Reads the latest file on `main` |
| **Custom**: `review-config` | French | Reads the latest file on `review-config` |

## When a saved source is unavailable

When you save **Custom**, CodeRabbit checks that it can read the branch and that the file is valid. If not, the previous source stays active. If a saved source later becomes unavailable, for example after the branch is deleted, reviews use **Auto** and show this warning:

> The selected configuration source is unavailable or invalid. This review used Auto. Check the repository's Configuration source settings.

The **Source mode** line in **Run configuration** then reads, for example, `Auto (fallback from Default branch)`.

## What the configuration source doesn't change

The configuration source only selects which repository file CodeRabbit loads. It doesn't change:

* The repository's **Use organization settings** toggle or saved web interface settings.
* Whether inheritance runs. The `inheritance` value in the selected file decides that.
* Global overrides and workspace settings used as defaults, which still apply afterwards.

## What's next

> [card] [Check which configuration a review used](https://docs.coderabbit.ai/configuration/guides/check-effective-configuration.md)
>
> Read **Run configuration** to see the source mode, branch, file and commit a review used.

> [card] [Validate and test a configuration change](https://docs.coderabbit.ai/configuration/guides/validate-and-test.md)
>
> Try a configuration change on a pull request before it reaches every review.

> [card] [Enforce settings teams can't change](https://docs.coderabbit.ai/configuration/guides/enforce.md)
>
> Combine a pinned source with global overrides so pull requests can't rewrite review policy.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.