---
title: Worktrees
description: Run several git worktrees side by side, each with its own databases and hostnames.
---

| Command               | Run                                                                                                               |
| --------------------- | ----------------------------------------------------------------------------------------------------------------- |
| `bun run wt:setup`    | Inside a new worktree. `--no-seed` skips demo telemetry; `--days` and `--concurrency` tune it. Safe to run again. |
| `bun run wt:teardown` | Before removing the worktree.                                                                                     |
| `bun run wt:prune`    | To drop the stores of worktrees that no longer exist.                                                             |

- A worktree uses the stores of the main checkout. Start them there with `docker compose up -d`, never inside a worktree.
- It gets its own PostgreSQL database copied from the main one, a ClickHouse database with 14 days of demo telemetry, a Redis database, a bucket and hostnames.
- `wt:setup` copies each `.env` from the main checkout (or `.env.example`) and writes a `.env.local` that points at the worktree's stores. It rewrites `.env.local` on every run: keep your own values in `.env`.

| Service      | Main checkout                       | Worktree                          |
| ------------ | ----------------------------------- | --------------------------------- |
| `web`        | `https://openperf.localhost`        | `https://<name>.localhost`        |
| `api`        | `https://api.openperf.localhost`    | `https://api.<name>.localhost`    |
| `api-ingest` | `https://ingest.openperf.localhost` | `https://ingest.<name>.localhost` |
| `mcp`        | `https://mcp.openperf.localhost`    | `https://mcp.<name>.localhost`    |

`<name>` is the worktree directory with a short hash, such as `feat-auth-3fa2`.

With [worktrunk](https://worktrunk.dev), `wt switch --create` runs `wt:setup` and `wt remove` runs `wt:teardown`.
