Eslam HelmyEslam Helmy
5 min readEslam

Git Worktrees + AI Agents — The Setup Nobody's Talking About

Git worktrees have existed for years, but almost nobody used them. The reason was simple — our workflow never demanded it. You would create a feature branch, work on one task, finish it, merge, and move on. One branch at a time was perfectly fine.

That changed when AI agents entered the picture.

Now you can have multiple agents — Claude Code, Codex, Gemini — all working simultaneously on the same project. But there is a catch: if they all operate on the same branch, they will overwrite each other's changes. Each agent will see modifications it did not make, leading to confusion and broken code. And if you try switching branches manually, Git will not allow you to checkout more than one branch at a time.

This is exactly where Git worktrees come in.

What Is a Git Worktree?

A worktree creates a new folder with a complete copy of your codebase — similar to cloning, but significantly faster and lighter on disk. The key advantage is that all worktrees share the same Git database. This means no duplicate .git directories eating up space, and all your branches, history, and refs stay in sync.

The real question becomes: how do you manage multiple worktrees across multiple projects, each with its own set of AI agents? You need different tools and a different workflow than what you are used to.

Setup 1: Warp Terminal + Worktrunk

The first setup uses two tools: Warp (a cross-platform terminal) and Worktrunk (a lightweight wrapper around Git worktree commands).

Why Warp?

Warp is fast, and it has two features that make it perfect for multi-agent workflows:

  • Split Panes — Open multiple terminals side by side with a simple shortcut (Cmd+D). Each pane runs its own agent in its own worktree.
  • Broadcast Input — Type a command once and it executes across all open panes simultaneously. This is incredibly useful when you need to run the same setup command in every worktree.

Why Worktrunk?

Worktrunk is a wrapper that simplifies Git worktree commands. Instead of typing long git worktree add commands, you get short, memorable alternatives. This is especially useful with tools like Codex that do not have built-in worktree support.

The Workflow in Action

After installing Warp and Worktrunk, the workflow looks like this:

  1. Open your project in Warp and navigate to the repo directory.

  2. Split into three panes — one for each agent (e.g., two Claude Code instances and one Codex).

  3. Create worktrees for each agent:

# Claude Code has built-in worktree support
claude --worktree resets-wt-1
 
# Second Claude instance
claude --worktree resets-wt-2
 
# Codex needs Worktrunk since it lacks native worktree support
wt create resets-wt-3
codex
  1. Use Broadcast Input to send the same command to all panes at once. For example, asking each agent to create a markdown file explaining the project — one command, three agents, three worktrees, zero conflicts.

  2. Merge and clean up when done. Inside Claude Code, push the feature branch and create a PR as usual:

# Claude Code handles this natively
git add .
git commit -m "Add project explanation"
git push

For cleanup, Claude Code offers a built-in option when you exit (/exit) — it asks whether to keep or remove the worktree. For Codex worktrees managed through Worktrunk:

# Remove a worktree (use --force if there are uncommitted changes)
wt remove resets-wt-3 --force

Bonus: IDE Integration

Warp has a setting under Features where you can choose your preferred editor for opening file links. Set it to Rider, VS Code, or whatever IDE you use, and clicking any file path in the terminal opens it directly in your editor. This works seamlessly with worktree paths too.

Setup 2: Supersets (Mac Only)

The second setup is an application called Supersets. It eliminates the need to create worktrees manually.

How It Works

  1. Add your repository to the application.
  2. It shows your local branches. From any branch, you can launch an AI agent directly.
  3. Create a new workspace — pick your agent (Claude, Codex, Gemini, etc.), optionally name the workspace and branch, and hit Enter. Supersets creates the worktree and launches the agent automatically.
  4. Open any workspace in your IDE with a single button click. You can configure which IDE to use in the settings.

The entire worktree lifecycle — creation, agent launch, IDE opening — is handled through a clean visual interface. No terminal commands needed.

The Catch

Supersets is currently Mac-only. It is not cross-platform yet, though that will likely change with time.

Which Setup Should You Use?

Both setups achieve the same goal: running multiple AI agents on the same repository without conflicts. The choice comes down to preference:

  • Warp + Worktrunk if you want cross-platform support, terminal-first workflow, and full control over the process.
  • Supersets if you are on Mac and prefer a visual interface that handles everything automatically.

There are certainly other setups out there, but in the end, it is about what feels fastest and most comfortable for your workflow. Pick whichever gets you into a productive flow state and stick with it.

Key Takeaways

  • Git worktrees let multiple AI agents work on the same repo simultaneously without branch conflicts.
  • Each worktree shares the same Git database — lightweight and fast compared to cloning.
  • Claude Code has native worktree support (--worktree flag), while Codex requires Worktrunk as a wrapper.
  • Warp's Broadcast Input feature lets you send the same command to all agent terminals at once.
  • Supersets automates the entire worktree workflow through a GUI, but is currently Mac-only.

Share this post