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

# bead worktree CLI commands

> Find bead worktree CLI commands for setup, preparation, execution, services, sharing, snapshots, and environment values.

Run bead worktree CLI commands from your Git worktree root. Configure [bead.toml](https://docs.bead.run/worktrees/configuration.md) first.

## Worktree commands

| Command | Options and behavior |
| - | - |
| `bead worktree up` | Create or recover the machine and sync source. `--rebuild` rebuilds the template; `--machine ID` explicitly associates an existing matching machine. |
| `bead worktree prepare` | Sync and run `prepare.run` to reconcile dependencies and schema. |
| `bead worktree exec -- ARGV...` | Sync and run literal Linux arguments. `--timeout` defaults to 21600 seconds, range 1–86400; repeat `--pull PATH` for artifacts. |
| `bead worktree dev NAME` | Sync once and run the service with localhost forwarding. `--local-port 0` allocates a local port. |
| `bead worktree share NAME` | Create a preview link. `--ttl` defaults to `24h`, maximum seven days; `--revoke` revokes saved links for that service. |
| `bead worktree status` | Read state without waking; `--all` lists authorized resources; `--execution ID` recovers retained output. |
| `bead worktree stop` | Stop a managed command or service after a disconnected CLI. |
| `bead worktree down` | Delete the bound machine and wait for acknowledgement. |
| `bead worktree prune` | Preview eligible removed-worktree orphans; `--apply` requests cleanup. |
| `bead worktree snapshot` | Build a prepared snapshot; `--commit REF` selects a clean local commit. |

```bash theme={null}
bead worktree up
bead worktree prepare
bead worktree exec --pull target/release/tool -- cargo build --release
# Replace ARTIFACT_DIR with the printed cache directory before copying.
cp ARTIFACT_DIR/target/release/tool ./tool
bead worktree down
```

Use an explicit shell for expressions: `bead worktree exec -- sh -lc 'cargo check && cargo test'`. See [execution and artifacts](https://docs.bead.run/worktrees/exec.md) and [recovery](https://docs.bead.run/worktrees/recovery.md).

## Environment commands

```bash theme={null}
bead env import .env.local
bead env import .env.web --service web
bead env ls --project my-project
bead env unset DATABASE_URL --service web
```

All three commands accept `--project NAME`. `import` and `unset` also accept `--service NAME`; `ls` groups stored names for the project. The default project comes from `bead.toml` or the inferred project name. Listing prints names only. See [environment and vault](https://docs.bead.run/worktrees/environment.md) for precedence and injection.


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