Git Worktrees for Parallel Agents
Using Git worktrees to run multiple Claude Code sessions against the same repository in separate working directories, so parallel agents can work without constantly colliding over the same files.
Key points
- Claude Code's
--worktreeflow creates isolated working directories tied to separate branches [src-011] - This enables three to five parallel sessions to explore or implement different parts of a project without file conflicts [src-011]
- Worktrees are especially useful for comparison tasks: one agent can test an approach while another explores an alternative [src-011]
- The pattern works best when each agent has a clear ownership boundary and a narrow brief [src-011]
- GitHub's June 2026 explainer reframes worktrees for the AI coding era: humans and agents now work in parallel more often, so separate directories reduce stash conflicts and editor disruption [src-098].
- Worktrees carry operational costs: duplicate dependencies, folder cleanup, ignore-file hygiene, and the rule that one branch cannot be checked out in multiple worktrees at the same time [src-098].
Related entities
- Claude Code — runtime that launches worktree-backed sessions
Related concepts
- Agent Teams — related multi-agent coordination pattern
- Decomposition Pattern — split the project into parallelisable parts
- Session Chaining — complementary approach for sequential decomposition
- Harness Engineering — wider operating layer that makes agent work safe to run in parallel
Source references
- [src-011] Nate Herk — Claude Code power features cluster (2026-04-20 to 2026-04-27)
- [src-098] Cassidy Williams – "What are git worktrees, and why should I use them?" (2026-06-16)
Recommended next
Keep reading from this thread
From 500 indexed pages and articles.
- Wiki concept Session Chaining The practice of decomposing a large project into a sequence of specialised Claude Code sessions — discovery, planning, execution — where each session's output Related by 011
- Wiki concept Agent Teams A Claude Code multi-agent mode where agents share a task list, can communicate directly with each other, and can assign work to one another Related by 011
- Wiki concept Session Handoff The practice of packaging the useful state from a Claude Code session into a concise handoff document before clearing context or moving work into Related by 011