Isolation Modes
GSD supports three isolation modes, set viagit.isolation in your PREFERENCES.md:
none
Default. Work happens directly on your current branch. No worktree or milestone branch is created. Best for hot-reload workflows or small projects where branch overhead isn’t worth it.
worktree
Each milestone gets its own directory at
.gsd/worktrees/<MID>/ on a milestone/<MID> branch. Work is fully isolated. Squash-merged to main on completion.branch
Work stays in the project root but on a
milestone/<MID> branch. No separate directory. Useful for submodule-heavy repos where worktrees cause symlink problems.PREFERENCES.md:
Worktree mode requires at least one commit in the repository. In a zero-commit repo, GSD temporarily falls back to
none mode until the first commit exists, then automatically resolves to worktree.Worktree CLI Commands
Use these commands from your shell (outside a GSD session) to inspect and manage worktrees:In-Session Worktree Commands
From inside an active GSD TUI session, use the/gsd worktree family of commands (alias: /gsd wt):
| Command | Description |
|---|---|
/gsd worktree list | Show each worktree’s branch, path, diff stats, commit count, and status |
/gsd worktree merge [name] | Merge a worktree into main and remove it afterward |
/gsd worktree clean | Remove merged or empty worktrees; keep anything with pending changes |
/gsd worktree remove <name> | Remove a named worktree and its branch |
/gsd worktree remove <name> --force | Force-remove, discarding unmerged or uncommitted work |
Starting a Session in a Specific Worktree
Use the--worktree flag (short: -w) when launching GSD to open a session directly inside a named worktree:
Merge Behavior
When a worktree milestone completes, GSD handles the merge automatically:Sequential commits on the milestone branch
All task commits land on
milestone/<MID> with conventional commit messages and GSD-Task trailers.Squash merge to main
By default, all commits are squashed into one clean commit on your main branch. Change this with
git.merge_strategy: merge to preserve individual commits.Parallel Milestones
When you have independent milestones, you can run them simultaneously in separate worktrees. GSD’s parallel orchestration engine manages worker processes, coordinates shared project state, and merges back to main when each milestone finishes. Use the/gsd parallel commands to manage parallel execution:
| Command | Description |
|---|---|
/gsd parallel start | Analyze eligibility and spawn workers for ready milestones |
/gsd parallel status | Show all workers with their state, progress, and cost |
/gsd parallel stop [MID] | Stop all workers, or a specific milestone’s worker |
/gsd parallel pause [MID] | Pause all workers, or a specific one |
/gsd parallel resume [MID] | Resume paused workers |
/gsd parallel merge [MID] | Merge completed milestones back to main |
Safety Behavior
Auto-commit before merge
worktree merge auto-commits dirty files in the worktree before merging when possible, so you don’t lose uncommitted work.Conflict-aware merge
Merge stops and reports which files conflict rather than silently failing. Resolve manually, then retry with
/gsd parallel merge <MID>.Clean only safe worktrees
worktree clean never removes worktrees with pending diffs or uncommitted changes — only merged or empty ones.Detached HEAD protection
Merge and worktree flows refuse to proceed from a detached project root. Check out your integration branch first.
Worktree Post-Create Hooks
Run a custom script automatically after GSD creates a new worktree — useful for copying.env files, symlinking asset directories, or running setup commands the worktree doesn’t inherit from the main tree:
SOURCE_DIR (the original project root) and WORKTREE_DIR (the newly created worktree path).
