Git worktrees
Several agents editing the same checkout will overwrite each other. With worktrees on, each pane gets its own checkout of the repo on its own branch:
claudegrid --worktrees
claudegrid -w -n 3 -p "approach A" -p "approach B" -p "approach C"or in a config:
{ "worktrees": true }Where they go
Worktrees are created next to the repo, never inside it:
~/code/app/ your checkout
~/code/app.claudegrid/grid-pane-1/ branch claudegrid/grid/pane-1
~/code/app.claudegrid/grid-pane-2/ branch claudegrid/grid/pane-2Branch names come from the preset (or grid) and the pane name. With a preset feature and a pane named api, the branch is claudegrid/feature/api.
New branches start from your current HEAD. When you open the same grid again, claudegrid reuses the existing worktrees, so every agent continues where it left off.
A pane dir such as web maps into the worktree too, so that pane starts in app.claudegrid/grid-web/web.
Review and merge
They are ordinary git branches:
git log main..claudegrid/grid/pane-2
git diff main...claudegrid/grid/pane-2
git merge claudegrid/grid/pane-2List and clean
claudegrid worktreesclaudegrid/grid/pane-1 clean, 3 commits ahead
~/code/app.claudegrid/grid-pane-1
claudegrid/grid/pane-2 2 changed
~/code/app.claudegrid/grid-pane-2claudegrid worktrees clean # remove clean worktrees and merged branches
claudegrid worktrees clean --dry-run # show what would go
claudegrid worktrees clean --force # also drop uncommitted changes and unmerged branches
claudegrid worktrees clean --keep-branchesWithout --force, cleaning never throws work away. Worktrees with uncommitted changes are skipped, and branches with unmerged commits are kept.