How I Run 5+ AI Agents in Parallel on the Same Repo with Git Worktrees
Source: Dev.to
The Problem
If you’re using AI coding agents like Claude Code, Cursor, or Windsurf, you’ve probably hit this wall: you want to run multiple agents on the same codebase at the same time, but they keep stepping on each other’s files.
Cloning the repo multiple times works but wastes disk space and creates divergent git histories. Branches don’t help because agents modify the working directory.
To be fair, some tools already get this — Claude Code Desktop and Codex create worktrees automatically. But they each do it their own way, there’s no unified interface to browse or manage those worktrees, and once the agent is done you’re left with scattered directories you have to clean up manually.
The Solution: Git Worktrees
Git worktrees let you check out multiple branches of the same repo simultaneously, each in its own directory, sharing the same .git folder. No duplication of history, instant creation.
The catch? The built‑in git worktree commands are clunky. You have to manage paths manually, name things yourself, and remember where everything lives.
Enter git-wt
I built git-wt — a Bash wrapper that makes worktrees painless.
Typical workflow
# Create 3 isolated worktrees from main
git wt add main --copy-env # → "swift-jade"
git wt add main --copy-env # → "bold-ember"
git wt add main --copy-env # → "calm-frost"
# Open each in a separate editor window
git wt open swift-jade --editor cursor
git wt open bold-ember --editor cursor
git wt open calm-frost --editor cursor
# Launch Claude Code / AI agent in each window
# They work independently — no conflicts
Key Features
- Auto‑naming – Each worktree gets a memorable adjective‑noun name like
swift-jade. No more thinking about paths. - Centralized storage – All worktrees live in
~/.git-wt/instead of cluttering your project directory. --copy-env– Automatically copies.envand other config files so the worktree is ready to run from the start.- Shell completions – Full tab completion for Bash and Zsh (commands, flags, and worktree names).
- Editor integration –
git wt open --editor codeopens the worktree directly in your editor. - AI agent support – Ships with a
SKILL.mdfile, so tools like Claude Code can discover and usegit-wton their own — no need to paste commands or explain the API.
Installation
git-wt is pure Bash with zero dependencies:
curl -fsSL https://raw.githubusercontent.com/kuderr/git-wt/main/install.sh | bash
After that, it works as a git subcommand: git wt .
Beyond AI Agents
While I built this primarily for AI agent workflows, it’s useful whenever you need to work with multiple branches:
- Code reviews – Check out a PR in a separate worktree while keeping your work untouched.
- Hotfixes – Quickly create a worktree for a fix without stashing your current changes.
- Testing – Run tests in one worktree while developing in another.
Try It
GitHub:
Stars and feedback are welcome. If you have feature ideas, open an issue — I’m actively developing this.