Why Parallel Agents?
In the AI-assisted development era, you can leverage multiple coding agents simultaneously:- Claude Code fixing authentication bugs
- Command Code building API endpoints
- Cursor creating UI components
Quick Start
Create multiple worktrees instantly
Create three worktrees for different features in one command:This creates:
repo-auth/withauthbranchrepo-api/withapibranchrepo-dashboard/withdashboardbranch
-x flag skips opening editors automatically.Work in parallel
Each agent now operates independently:
- No branch switching conflicts
- No stash/unstash cycles
- No context loss between tasks
- Each agent maintains its own state
Real-World Workflow
Bug Fixes
Assign critical bugs to different agents:Each agent can investigate and fix independently.
Feature Development
Split a large feature across multiple agents:Coordinate full-stack development in parallel.
Testing Approaches
Try different implementations simultaneously:Compare solutions before committing.
Refactoring Tasks
Tackle refactoring modules in parallel:Keep refactoring isolated from new features.
Merging Work
Once an agent completes its work:- Checks out main
- Merges the
authbranch - Removes the
repo-auth/worktree - Deletes the
authbranch
Best Practices
Keep tasks independent
Keep tasks independent
Assign tasks to agents that don’t overlap in the same files. This prevents merge conflicts and allows true parallel work.
Use descriptive names
Use descriptive names
Name worktrees clearly to track which agent is working on what:
Monitor regularly
Monitor regularly
Use
gwt status frequently to track progress across all agents:Clean up completed work
Clean up completed work
Remove merged worktrees regularly:
Advanced: Fast Mode
For even faster setup, use-y to skip all prompts:
Troubleshooting
Agent conflicts on same files
Agent conflicts on same files
If two agents need to work on overlapping code:
- Let one agent complete and merge first
- Update main:
cd repo && git pull - Rebase the other agent’s work:
cd repo-feature && git rebase main
Worktree creation fails
Worktree creation fails
Ensure you’re in a git repository and have a clean working directory:
Next Steps
Feature Development
Learn the complete feature development workflow with worktrees.
Code Review
Review PRs without disrupting your current work.