Advanced

Git Worktrees

Work on multiple things at once without mixing them up.

The concept

Imagine you’re working on your house. You have a renovation going in the kitchen and another in the bathroom. You wouldn’t mix up the materials or start tearing down walls in both rooms at once.

Git worktrees are the same idea for files. You can have multiple “workspaces” active at the same time, each doing something different, without them interfering with each other.

Why this matters for Claude

When Claude makes changes, you want to be able to:

  • Review before committing — See what changed before it’s permanent
  • Work on multiple things — Have Claude work on one project while you do something else
  • Easily undo — If something goes wrong, throw it away without affecting your main work

Worktrees give you this safety net.

For developers

Git worktrees let you check out multiple branches simultaneously in different directories:

# Normal git: one directory, one branch
~/repos/my-project/  # on main

# With worktrees: multiple directories, different branches
~/repos/my-project/       # base (on main)
~/work/feature-a/         # worktree (on feature-a)
~/work/feature-b/         # worktree (on feature-b)

Why worktrees for Claude?

  1. Isolation — Claude’s changes are on a separate branch, not main
  2. Parallel sessions — Run multiple Claude sessions on different features
  3. Easy review — Diff against main before merging
  4. Safe experimentation — Discard a worktree if things go wrong

Basic commands

# Create a worktree for a feature
cd ~/repos/my-project
git worktree add ~/work/feature-x -b claude/feature-x

# See all worktrees
git worktree list

# Remove when done
git worktree remove ~/work/feature-x

The workflow

  1. Start: git worktree add ~/work/feature -b claude/feature
  2. Work: Claude makes changes, commits as it goes
  3. Review: git diff main... to see all changes
  4. Merge: Create PR or merge locally
  5. Clean: git worktree remove ~/work/feature

Running parallel sessions

Each worktree is independent:

# Terminal 1: working on search
cd ~/work/search-improvement
claude

# Terminal 2: working on docs
cd ~/work/docs-update
claude

# Terminal 3: different project entirely
cd ~/work/new-source
claude

Each works on its own branch without interfering.

Branch naming convention

All Claude work happens on branches prefixed with claude/:

claude/hybrid-search
claude/docs-update
claude/fix-auth-bug

This makes it easy to see which branches were created by Claude sessions, push them all at once, and clean up after merging.

The mental model

Worktrees are cheap, disposable working directories. Create them freely, merge what works, delete what doesn’t. The base repo stays clean.

Or let Claude handle it

Instead of managing worktrees yourself, you can use a skill that does it for you. This worktree skill handles creation, cleanup, and the whole workflow — just tell Claude what feature you want to work on.