---
metadata:
  - name: generator
    content: Diplodoc Platform v5.50.6
alternate:
  - https://sourcecraft.dev/portal/docs/en/cli-ref/src-pr-checkout.md
  - https://sourcecraft.dev/portal/docs/ru/cli-ref/src-pr-checkout.md
---
> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt

# src pr checkout

Check out the source branch of a pull request in the local git repository.

## Usage

`src pr checkout [<number> | <url> | <branch>] [flags]`

### Examples

**Checkout current PR (based on current branch)**

`src pr checkout`

**Checkout pull request by number**

`src pr checkout 42`

**Checkout with custom local branch name**

`src pr checkout 42 --branch my-review-branch`

**Force reset if branch already exists**

`src pr checkout 42 --force`

**Checkout in detached HEAD state**

`src pr checkout 42 --detach`

### Flags

| Flag | Description |
| --- | --- |
| `-b, --branch string` | Local branch name to use |
| `--detach` | Checkout PR in detached HEAD state |
| `-f, --force` | Reset existing local branch |
| `--recurse-submodules` | Update submodules after checkout |

### Inherited flags

| Flag | Description |
| --- | --- |
| `--env string` | Override Sourcecraft environment (use 'src envs' to list available) |
| `--json string` | Output JSON, optionally filtered (--json or --json=field1,field2) |
| `--json-compact string` | Output compact JSON, optionally filtered |
| `-R, --repo string` | Select another repository using OWNER/REPO format |
| `-V, --verbose` | Enable debug logging output |

### Learn more

Use `src pr checkout <subcommand> --help` for more information about a command.
