Workflows

Isolated changes with worktrees

Use git worktrees to run Claude on a separate branch without affecting your main workspace.

Goal

Let Claude work on a task in parallel without touching your active working tree.

Outcome: A clean branch with Claude-generated changes ready to review and merge.

SafetyProductivity
Intermediate

Steps

1

Create a new worktree on a new branch

Spin up an isolated copy of the repo on a fresh branch.

git worktree add ../my-feature-worktree -b feature/my-task
2

Open Claude in that worktree

Start a session in the isolated directory.

cd ../my-feature-worktree && claude "implement the user dashboard feature"
3

Let Claude work

Claude modifies files in the worktree without affecting your main branch.

  • ·You can keep working in your main directory while this runs.
4

Review the diff

Check what Claude produced.

git diff main...feature/my-task
5

Merge or discard

Merge the branch if happy, or remove the worktree to discard.

git worktree remove ../my-feature-worktree

Cautions

  • Review all changes before merging — Claude works autonomously in worktrees.

Commands used