ClaudeHack
0.000

Run parallel Claude sessions in git worktrees

Git & GitHub / Pull Requests·13 hours ago·verified 13 hours ago·medium·~10 min setup·verified

Use `claude --worktree` (or git worktrees) so multiple agents edit isolated checkouts without colliding.

The problem

Two Claudes in one working tree race on the same files and create messy merges.

The hack

Launch each parallel session in its own worktree so file edits stay isolated while sharing the git object store.

Why it works

Official worktrees docs exist for exactly this: isolate parallel sessions so changes do not collide.

Setup

1. From the repo, start a session with `claude --worktree feature-a` (or create a worktree manually). 2. Open a second terminal with another worktree for feature-b. 3. Give each session a focused task. 4. Merge or open PRs from each branch when done; clean up worktrees after.

Code

claude --worktree feature-auth
# other terminal:
claude --worktree feature-tests

Additional details

Subagents can also set isolation: worktree for temporary isolated edits.

Source

anthropic·View original →·by Anthropic Docs

Does this still work?

0 said it works · 0 said it's broken

Discussion

No comments yet. Be the first to say whether this worked for you.