Running Two Claude Code Agents on the Same Repo with Git Worktrees

✍️ OpenClawRadar📅 Published: May 11, 2026🔗 Source
Running Two Claude Code Agents on the Same Repo with Git Worktrees
Ad

Running multiple Claude Code agents on the same repository simultaneously has been achieved using git worktrees. Each agent gets its own branch and dedicated working directory on disk, eliminating file conflicts and allowing reading/writing without interference.

Workflow

  • Create a git worktree for each branch.
  • Open a separate Claude Code session in each worktree directory.
  • Let the agents run in parallel — they are unaware of each other.
  • When both finish, merge the branches via normal git merge.

Practical Example

# Create a worktree for a feature branch
git worktree add ../repo-feature feature-branch
# Create a worktree for a bugfix branch
git worktree add ../repo-bugfix bugfix-branch

In each directory, start Claude Code

cd ../repo-feature && claude-code . cd ../repo-bugfix && claude-code .

Ad

Benefits

Speed improvement is real for parallelizable work: one agent fixing a bug while another drafts a new feature, or a refactor alongside test coverage. Not every task splits cleanly, but genuinely independent concerns benefit. User reports having one agent fixing a bug and another drafting a feature simultaneously without conflict.

Considerations

The user asks about reliability for longer-running tasks and whether merge conflicts become a problem at scale. Standard git merge resolution applies when merging worktree branches back.

Who It's For

Developers using Claude Code who want to parallelize independent tasks on the same codebase.

📖 Read the full source: r/ClaudeAI

Ad

👀 See Also