---
title: "tractorbeam branch"
description: "Manage a Workspace's Branches."
sidebar:
  label: "branch"
  order: 11
---

Manage a Workspace's Branches: switch to one and apply to it, then merge it into another.

```sh
tractorbeam branch <subcommand> [flags]
```

## Shared flags

Every subcommand takes these flags.

| Flag | Description |
| --- | --- |
| `--config <string>` | The Project's `tractorbeam.config.ts`. Defaults to the one in the current directory or its nearest ancestor. |
| `--workspace <string>` | Workspace identifier or resource name. Environment variable: `TRACTORBEAM_WORKSPACE`. |
| `--origin <string>` | The Tractorbeam origin to call instead of the default, such as a proxy's. Environment variable: `TRACTORBEAM_ORIGIN`. |
| `--token <string>` | Access token. Defaults to the saved interactive session. Environment variable: `TRACTORBEAM_TOKEN`. |

## `branch list`

List the Workspace's Branches, main first, marking the current one with \*.

```sh
tractorbeam branch list [flags]
```

## `branch create`

Fork a Branch from the current Branch's HEAD, or another's.

```sh
tractorbeam branch create [flags] <branch>
```

| Argument | Description |
| --- | --- |
| `<branch>` | The new Branch's name. |

| Flag | Description |
| --- | --- |
| `--from <string>` | The Branch whose HEAD the new Branch starts from; the current Branch by default. |

Examples:

```sh
# Fork feature-x from the current Branch
tractorbeam branch create feature-x

# Fork feature-x from main
tractorbeam branch create feature-x --from main
```

## `branch switch`

Make a Branch current, as git switch does: apply, plan, and branch merge target it unless `--branch` or `--into` names another.

```sh
tractorbeam branch switch [flags] <branch>
```

| Argument | Description |
| --- | --- |
| `<branch>` | The Branch to make current. |

| Flag | Description |
| --- | --- |
| `--create, -c` | Create the Branch first, as branch create does. |
| `--from <string>` | The Branch whose HEAD the new Branch starts from; the current Branch by default. |
| `--global` | Make the Branch current for every Project rather than only the one in the current directory. |

Examples:

```sh
# Make feature-x current
tractorbeam branch switch feature-x

# Create feature-x and make it current
tractorbeam branch switch -c feature-x
```

## `branch merge`

Merge a Branch into the current Branch, or the one `--into` names, as one merge Commit of its Resource definitions and its Tables' documents, as git merge does.

```sh
tractorbeam branch merge [flags] <branch>
```

| Argument | Description |
| --- | --- |
| `<branch>` | The Branch to merge. |

| Flag | Description |
| --- | --- |
| `--into <string>` | The Branch to merge it into; the current Branch by default. |
| `--strategy-option, -X <ours\|theirs>` | Resolve every conflict to the Branch merged into (`ours`) or the Branch merged (`theirs`). |
| `--dry-run` | Show what the merge would change without changing the Branch. |

Examples:

```sh
# Show what merging feature-x into the current Branch would change
tractorbeam branch merge feature-x --dry-run

# Merge feature-x into main, resolving each conflict to feature-x's side
tractorbeam branch merge feature-x --into main -X theirs
```

## `branch delete`

Delete a Branch other than the current one. You can still read its Commits by their IDs.

```sh
tractorbeam branch delete [flags] <branch>
```

| Argument | Description |
| --- | --- |
| `<branch>` | The Branch to delete. |

| Flag | Description |
| --- | --- |
| `--force, -f` | Also delete a Branch whose HEAD selects an App, or with Action Invocations still running. Deleting it cancels them. |
