Guide
Git worktrees for Claude Code and Cursor on a Mac
By Priyanshu Dangi · Jul 21, 2026 · 6 min read · Updated Aug 27, 2026
One git worktree per coding agent so Claude Code, Codex, and Cursor do not overwrite each other — the 60-second commands, then when to stop doing it by hand and use Zoku.
A git worktree is a second (or tenth) checkout of the same repository in its own folder, usually on its own branch. You get isolation for parallel AI coding agents without cloning the repo ten times or fighting over one working tree.
By the end you'll know:
- What a git worktree actually is
- How to create one in under a minute
- How to run multiple AI coding agents on different features at once
- The easiest way to do all of this with Zoku
The problem (why clones suck)
You want Agent A on auth, Agent B on billing, Agent C on settings.
If they all work in the same folder:
- They overwrite each other's files
- Git gets confused about which branch you're on
- One bad edit nukes another agent's progress
People usually “solve” this by cloning the repo 10 times. That works… until you're juggling 10 copies of node_modules, 10 forgotten branches, and zero shared git history.
Worktrees fix this.
What is a git worktree?
A worktree is a second (or tenth) checkout of the same repo, living in its own folder, usually on its own branch.
| Clone | Worktree | |
|---|---|---|
| Separate folder | Yes | Yes |
| Own branch | Yes | Yes |
| Shares the same .git history | No | Yes |
| Disk-heavy | Very | Light |
| Easy to clean up | Meh | One command |
You get isolation for agents without pretending you have 10 different repos.
my-project/ ← main (branch: main)
.zoku/worktrees/
feature-auth/ ← worktree
feature-billing/ ← worktree
feature-settings/ ← worktreeEach folder is a real project directory. Open it in Cursor / Claude Code / Codex. Commit normally. Agents don't step on each other.
Create your first worktree (60 seconds)
From your main repo:
# New branch + folder in one shot
git worktree add ../my-project-auth -b feature/auth
# Or attach an existing branch
git worktree add ../my-project-billing feature/billingCheck what you have:
git worktree listRemove one when you're done:
git worktree remove ../my-project-authThat's the whole primitive. Everything else is workflow.
The parallel-agent workflow
This is the pattern that scales past two agents:
- One worktree per feature —
feature/auth,feature/billing, … - One agent per worktree — Cursor in one folder, Claude in another, Codex in a third
- Merge when ready — review PRs independently, land them one at a time
Mental model
Agent 1 → worktree A → branch A → PR A
Agent 2 → worktree B → branch B → PR B
Agent 3 → worktree C → branch C → PR CSame repo. Same history. Zero interference.
Tips that save you pain
- Name folders after the feature, not the agent (
auth-fix, notcursor-3) - Don't reuse a dirty worktree for a new task — create a fresh one
- Closing a terminal ≠ deleting the worktree — clean up with
git worktree removewhen the branch is merged - One agent owns one worktree — never point two write-happy agents at the same folder
By hand vs with Zoku
By hand
Works fine for 2–3 agents:
git worktree add ~/.zoku/worktrees/auth -b feature/auth
git worktree add ~/.zoku/worktrees/billing -b feature/billing
# open each folder in your editor / agent CLIAt 10 agents, the bookkeeping gets annoying: paths, branches, which tile is which, cleanup.
With Zoku
Zoku is a native Mac canvas: one tile per agent, one worktree per tile. Hold ⌥⌘ and say “open a Claude worktree named auth-fix”.
Zoku will:
- Create (or reuse) a worktree for that feature
- Put the agent in its own tile
- Keep agents isolated so they don't overwrite each other
Closing a tile does not delete the worktree — your work stays until you clean it up with git.
That's how you actually run 10 agents on 10 features without turning your machine into a folder graveyard.
Quick start with Zoku
- Get Zoku for Mac
- Hold ⌥⌘ and say “open a Claude worktree named auth-fix”
- Spawn more agents — one feature per tile, one worktree per tile
- Let them cook in parallel
- Review → PR → merge → remove stale worktrees when you're done
Cheat sheet
# Create
git worktree add <path> -b <new-branch>
git worktree add <path> <existing-branch>
# List
git worktree list
# Remove
git worktree remove <path>
# After deleting folders by hand
git worktree pruneTL;DR
- Worktrees = multiple folders, one repo, isolated branches
- One worktree per feature = safe parallel agents
- Zoku = the canvas that makes spawning those agents dead simple