Skip to content

Worktrees

Two agents in one checkout end up editing the same files. A git worktree gives each agent a checkout of its own branch while sharing one repository. Cortland creates the worktree and opens a pane in it in one step.

From the Worktrees panel, open a branch as a worktree in a new pane, and optionally start an agent in it.

The Worktrees panel: a new-branch field, a Create button that can run a shell, Claude, or Codex in the new pane, a Start sandboxed option, and the repository's main checkout with its status

Cortland creates the worktree, or reuses an existing one, in a sibling directory:

~/Repos/app/ your main checkout, untouched
~/Repos/app.worktrees/login/ branch "login"
~/Repos/app.worktrees/billing/ branch "billing"

Agents and scripts can do the same from the command line:

Terminal window
cortland-ctl pane split "$CORTLAND_PANE_ID" --worktree feature/login --no-focus --exec claude

The Worktrees panel shows each worktree’s branch, the agent working in it, and its changes. Changes vs main in the Git panel opens the branch diff in the changes pane.

Merging from the panel stages everything, commits with a drafted message, merges, shows progress and the result, and then offers to remove the worktree.

Terminal window
cortland-ctl worktree list
cortland-ctl worktree remove feature/login
cortland-ctl worktree prune