Skip to content
BENIBIX Learn

Worktree Isolation

AI⌨️ Claude CodeClaude Code Concepts

Also known as claude --worktree, claude -w, isolation: worktree

Claude in its own copy of the code, on its own branch.

Think of it like

It is like giving each cook their own cutting board. Then no one chops on someone else's food.

Example

Emma wants Claude to build two features at once. She starts two sessions with -w, one per feature, and merges each branch when it is done.

Why it matters

It is what makes it safe to run several agents on the same project at the same time.

Definition

Worktree isolation runs Claude in its own git worktree. That is a second copy of your project, on its own branch. You start it with --worktree or -w and a name. By default the copy goes in .claude/worktrees/, on a new branch named after it. A subagent can do the same with isolation: worktree in its settings. Each session edits its own copy, so several can work at once without clashing.

Example code

bash
claude --worktree feature-auth
Start Claude in a new worktree called feature-auth.
Two worktrees, two branches, two sessions, no clash.

Common mistake

Forgetting the worktree exists. Each one is a real folder and branch, so merge or remove it when the work is done.

Key takeaways

  1. 1
    Its own copy. A git worktree.
  2. 2
    Its own branch. Named after it.
  3. 3
    No collisions. Run many at once.

Learn it properly