~4m7:13
Better Stack

The Best Git Worktree Tool I've Used (Worktrunk)

Oct 31, 2026

Read: ~4m · You save: 3 min

The Best Git Worktree Tool I've Used (Worktrunk)

Running several AI agents in one repo without conflicts: Worktrunk simplifies Git worktree, merging and dependency copying. Pros and pitfalls covered.

Claude Code's built-in git worktrees already let you create separate working copies of a repository. Meanwhile, the standalone tool Worktrunk is quickly gaining popularity and releases new versions roughly three times a week. Below, its features, design, and limitations are described.

The Problem: Multiple Agents in One Folder

If you run two AI agents in the same repository, they share a single folder. Agent A may be in the middle of a refactor, and Agent B's tests start failing. It's like two people writing on the same sheet of paper.

Git worktree solves this problem. Each agent gets its own copy of the repository in a separate folder and on a separate branch.

With plain Git, working with worktrees requires many commands:

  • Creating a worktree and switching into it requires specifying the branch name three times.
  • Cleanup takes three more commands.
  • The git worktree list command outputs a list of folder paths, not the status of tasks.

Built-in worktrees in Claude Code simplify creation but do not provide:

  • Commands for merging results back into the main branch.
  • A single overview of what each agent is doing.
  • Automatic installation of dependencies. According to the documentation, the user must ask Claude to install them manually.

How Worktrunk Works

Basic Scenario

In the demo, three terminals are running, each executing a single wt switch command with a branch name. Each agent gets its own branch, its own folder, and its own copy of the repository with shared history.

The wt list command shows in one window:

  • all worktrees;
  • the branch of each one;
  • the number of commits ahead of the main branch;
  • the size of the diff.

The robot icon indicates that the agent is working. The speech bubble icon indicates that the agent is waiting for user action.

The wt switch command takes the user to the required worktree without the need to remember folder paths.

Merging Results

The wt merge command performs a sequence of actions:

  1. Creates a commit.
  2. Squashes the commits into one.
  3. Rebases onto the main branch.
  4. Performs a fast-forward merge.
  5. Removes the worktree.

Six Git commands are replaced by one.

Architecture

Worktrunk is written in Rust and distributed under the MIT or Apache license. The tool determines the folder location using a template based on the branch name.

The program cannot change the current directory of the terminal; only the shell can do that. Therefore, Worktrunk installs a small shell function with the command wt config shell install. Without this step, the transition to the folder does not happen, and no error is displayed.

Integration with Claude Code

Worktrunk hooks into the worktree creation mechanism in Claude Code. Worktrees that Claude creates on its own also go through Worktrunk.

The tool supports plugins for six CLI agents, including Codex, OpenCode, and Gemini CLI.

Copying Ignored Files

A new worktree contains the code but not the files that Git ignores: dependency modules, build cache, and environment (env) files. Each new agent starts work with a cold install and a cold build. When five agents are launched, these costs are repeated five times.

The wt step copy-ignore command copies such files using copy-on-write. On a Mac with the APFS file system, the new folder references the same disk blocks until the contents change. Copying takes almost no time and uses almost no extra disk space.

According to the author, for a 14 GB Rust build folder:

Copy methodTimeDisk space used
Regular copy2 minutes 14 seconds14 GB
Copy-on-writeabout 20 secondspractically 0 GB

The first Rust build drops from about 68 seconds to 3–4 seconds. The author presents these figures as his own measurements, and they should be verified on your own configuration.

Development Server Ports

The hashport filter assigns each worktree its own development server port. Three agents can work with three servers simultaneously without conflicting over port 3000.

Comparison with Alternatives

  • Built-in worktrees in Claude Code create worktrees automatically, but they lack a merge command and status overview.
  • Vibe Kanban provides a full-featured kanban board for agents. It is convenient when working through a graphical interface, but less convenient for those who work in the terminal.
  • Worktrunk works in the terminal and includes hooks and merging.

Limitations

  • Version below 1.0. The current version is 0.8.1. The word "breaking" appears more than 80 times in the changelog, about eight of them in the latest release. You may need to change the configuration when updating.
  • Merge conflicts are preserved. If two agents edit the same file, wt merge stops the rebase and hands the conflict over to the user.
  • Copy-on-write does not work on all file systems. It is available on APFS (macOS) and some other file systems. On Linux with ext4, full copies are created, and native modules require rebuilding.
  • Project hooks run shell commands. The program asks for confirmation before the first run. Users should read carefully the commands they confirm.

Who It's For

If you run a single agent, Worktrunk isn't necessary: Claude Code's built-in worktrees are sufficient.

If you have three, five, or more agents running and managing folders, installing dependencies, and merging becomes cumbersome, Worktrunk fills the missing part of the work.

The author argues that the model is no longer the bottleneck for parallel agents.

The Problem with Parallel Agents and Git Worktrees

The problem of parallel agents working in the same folder, and why separate worktrees are needed.

  • Two AI agents in the same repository conflict if they work in the same folder (for example, agent B's tests fail because of agent A's refactoring)
  • A Git worktree is a second copy of the repository on a separate branch in a separate folder
  • Regular Git requires typing the branch name three times to create and switch, and cleanup takes three more commands
  • git worktree list only outputs a list of folder paths
  • Built-in worktrees in Claude Code handle creation but do not provide merge commands or a unified overview of agents; for dependencies, the documentation advises asking Claude to install them

Demonstration: Launch, List, and Merge

Demonstration of Worktrunk: creating, listing, and switching between worktrees, and merging results.

  • The command wt switch claude feature creates a separate working copy on its own branch and folder in one line
  • wt list shows all worktrees on one screen: the branch, commits ahead of main, diff size, and agent status (robot icon means working, speech bubble icon means waiting for the user)
  • wt switch moves to the needed worktree without remembering folder paths
  • wt merge performs commit, squash, rebase onto main, fast-forward, and removes the worktree, replacing six Git commands with one

How It Works

Technical basis: Rust CLI, a shell function for changing directories, integration with Claude Code and other agents, copying ignored files.

  • Worktrunk is written in Rust, licensed under MIT or Apache
  • The program cannot change the terminal's directory, so a shell function is installed with the command wt config shell install; without it, the CD silently does not happen
  • The plugin hooks into Claude Code's worktree creation, so even worktrees Claude creates on its own pass through Worktrunk
  • Plugins exist for six agent CLIs, including Codex, OpenCode, and Gemini CLI
  • The command wt step copy-ignore copies Git-ignored files (node_modules, build cache, env) via copy-on-write on APFS (Mac)
  • According to the author, building a 14 GB Rust folder takes 2 minutes and 14 GB with ordinary copying, and about 20 seconds with almost no extra disk space via copy-on-write; the first Rust build drops from about 68 seconds to 3–4
  • The hashport filter gives each worktree its own dev server port, avoiding conflicts on port 3000

Comparison, Limitations, and Conclusions

Comparison with alternatives and the tool's limitations, plus a recommendation on when to use it.

  • Claude Code's native worktrees enable auto-clutter but lack merging and status tracking
  • Vibe Kanban is a full-featured Kanban board for agents with a UI, convenient for those who don't work in the terminal
  • Worktrunk is a terminal tool with built-in hooks and merging
  • Version 0.8.1, pre-1.0; the word breaking appears more than 80 times in the changelog, about eight of them in the latest release; you may need to change your config
  • Worktrees do not resolve merge conflicts: if two agents edit the same file, wt merge stops the rebase and hands the conflict to the user
  • Copy-on-write works only on certain filesystems (APFS on Mac, ZFS and similar); on ext4 Linux, full files are copied and native modules require rebuilding
  • Project hooks run shell commands; the tool asks for permission before the first run, and they should be read carefully
  • If you run one agent at a time, Worktrunk isn't needed, since native worktrees are sufficient; with three, five, or more agents, it fills the missing part