# Branching (/docs/compute/branching)

Location: Compute > Branching

A branch is an isolated environment for one line of work. Every branch in a project gets its own apps, databases, and deployments, so work on a preview never touches production.

A platform branch usually matches a Git branch name, but in Prisma it is a real resource that owns its own apps and databases:

<ConceptAnimation name="compute-model" />

Production and preview [#production-and-preview]

Every branch has a role:

* The **first branch** in a project is your production branch, usually `main`. It's protected and durable: after the first deploy, deploys to it need an explicit `--prod` flag, and automated cleanup never touches it.
* **Every other branch** is a preview by default: disposable resources for testing changes before they merge. Preview deploys never ask for confirmation.

To learn more, see the [Deployments docs](/compute/deployments).

How the CLI picks a branch [#how-the-cli-picks-a-branch]

When you deploy, the CLI resolves the branch in this order:

1. `--branch <name>`, if you pass it.
2. Your active Git branch.
3. `main`.

Inside a Git repo, deploying from `feature/search` targets the `feature/search` branch automatically. To target a branch explicitly:

  

#### bun

```bash
bunx --bun @prisma/cli@latest app deploy --branch feature/search
```

#### pnpm

```bash
pnpm dlx @prisma/cli@latest app deploy --branch feature/search
```

#### yarn

```bash
yarn dlx @prisma/cli@latest app deploy --branch feature/search
```

#### npm

```bash
npx @prisma/cli@latest app deploy --branch feature/search
```

Inspect platform branches:

  

#### bun

```bash
bunx --bun @prisma/cli@latest branch list
```

#### pnpm

```bash
pnpm dlx @prisma/cli@latest branch list
```

#### yarn

```bash
yarn dlx @prisma/cli@latest branch list
```

#### npm

```bash
npx @prisma/cli@latest branch list
```

Listing branches doesn't expand the apps and databases inside them. Use the `app` commands to inspect those.

Creating branches [#creating-branches]

You rarely create branches manually. They appear when work needs them:

* **On deploy**: `app deploy --branch feature/search` creates the branch if it doesn't exist.
* **From GitHub**: when a repo is connected, branch and push events create or update the matching platform branch automatically. To set this up, see the [GitHub integration docs](/compute/github).

Connecting GitHub doesn't create branches retroactively; it wires up automation for future events.

Cleaning up [#cleaning-up]

When GitHub is connected, deleting a Git branch tears down the matching platform branch, as long as it isn't your production or default branch. Those are always left alone.

Next steps [#next-steps]

* [Environment variables](/compute/environment-variables): preview values and per-branch overrides.
* [GitHub integration](/compute/github): keep platform branches in sync with your repo.

## Related pages

- [`@prisma/cli`](https://www.prisma.io/docs/compute/getting-started): Deploy your first app to Prisma Compute with the @prisma/cli beta package, then learn the variations you'll need next.
- [`CLI reference`](https://www.prisma.io/docs/compute/cli-reference): Every @prisma/cli command, flag, environment variable, and error code for Prisma Compute.
- [`Configuration`](https://www.prisma.io/docs/compute/configuration): Declare your deployable app in a typed prisma.compute.ts file so deploys are reproducible and monorepos work, without re-passing flags every time.
- [`Deployments`](https://www.prisma.io/docs/compute/deployments): Build, deploy, inspect, promote, and roll back app deployments on Prisma Compute.
- [`Domains`](https://www.prisma.io/docs/compute/domains): Point a custom domain at a production app and the platform verifies DNS and provisions TLS for you.