# Worktree Isolation

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

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** claude --worktree, claude -w, isolation: worktree

## Think of it like

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

## 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

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.

## Example code

```bash
claude --worktree feature-auth
```

Start Claude in a new worktree called feature-auth.

## Why it matters

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

## Common mistake

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

## Three principles

- **Its own copy.** A git worktree.
- **Its own branch.** Named after it.
- **No collisions.** Run many at once.

## Related terms

- [Git](https://learn.benibix.com/term/development/git)
- [Branch](https://learn.benibix.com/term/development/branch)
- [Agent Teams](https://learn.benibix.com/term/ai/agent-teams)
- [Subagent](https://learn.benibix.com/term/ai/subagent)
- [Worktree Tools](https://learn.benibix.com/term/ai/worktree-tools)

## Taught in

- [Claude Code Run Modes](https://learn.benibix.com/learn/ai-claude-code/claude-code-run-modes): Claude Code, 16/16

![One repository, two worktrees side by side, each with its own branch and its own Claude session.](https://learn.benibix.com/diagrams/cc-worktree-isolation.svg)

---

Source: https://learn.benibix.com/term/ai/worktree-isolation
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
