Worktrees let you work on multiple branches at the same time, in separate folders. Claude Code has built-in support for them.
claude --worktree feature-auth # named
claude -w # auto-namedThis creates .claude/worktrees/<name> on a new branch worktree-<name>, branched from origin/HEAD.
If your origin/HEAD is out of date:
git remote set-head origin -aJust say:
"Create a worktree for this work."
Claude uses its built-in EnterWorktree tool. When you're done:
"Exit the worktree."
If you made no changes, it's auto-deleted. If you did, Claude asks whether to keep it.
Claude won't copy gitignored files by default. Add a .worktreeinclude at the repo root (uses .gitignore syntax):
.env
.env.local
config/secrets.json
Now those files get copied into every new worktree.
When delegating to subagents, pass isolation: "worktree" so each one gets its own worktree. Useful for fan-out tasks where agents would otherwise step on each other.
If you'd rather drive it yourself:
git worktree add ../myproj-feature -b feature
cd ../myproj-feature && claudeClean up later:
git worktree list
git worktree remove ../myproj-feature--worktreeflag — starting fresh work on a new branch- Ask Claude mid-session — you realized partway through you want isolation
- Subagent isolation — running parallel tasks that touch the same files
- Manual — you want full control over location and naming