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

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 .
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
👀 See Also

PreToolUse Hook Fixes Claude Code Image Crash Problem
A developer created a PreToolUse hook that intercepts Claude Code's Read calls on images, converts them safely, and proxies them through a Haiku subprocess to prevent API Error 400 crashes from problematic images.

Analyzing AI Coding Tools: Dissecting 3,177 API Calls
A technical breakdown of 3,177 API calls unveils how four AI coding tools manage context windows, revealing inefficiencies and variances.

Claude Desktop App Cowork Feature Enables AI-to-AI Communication via Shared Google Docs
Users have successfully implemented Claude-to-Claude communication using the new cowork function in the desktop app, with two agents reading and writing to a shared Google Doc. The test involved five rounds of question-and-answer dialogue between the AI agents.

Query Your Jira Sprint Via Claude MCP: Instant Status, Unassigned Issues, and Blocked Items
A Reddit user connected Jira to Claude via MCP, then asked plain‑language questions about their sprint and got instant clean tables — no clicking through boards.