wt: A Git Worktree Manager for Parallel AI Development

wt: A Git Worktree Manager for Parallel AI Development
Photo by Johann Siemens / Unsplash

The Problem

If you've tried running multiple Claude Code sessions against the same repository, you already know how it goes. One session edits a file while the other is running tests against it. Merge conflicts pile up. Each session's context gets contaminated by the other's changes, so the AI sees diffs it didn't make, gets confused about what state the code is in, and burns tokens trying to figure it out. You spend more time untangling messes than building features.

Git worktrees are an easy way to solve this. Each worktree is its own working directory backed by the same repository. Separate branches, separate file states, no interference. Managing worktrees by hand gets tedious fast: creating them, setting up branches, opening terminals, syncing with main, cleaning up when you're done. I wanted the isolation without the overhead.

So I built wt. As in "worktree". It's a command-line tool that automates the entire lifecycle of git worktrees, with a focus on making parallel AI-assisted development seamless and efficient.

What wt Does

wt manages the full lifecycle of git worktrees with a focus on parallel AI-assisted development. One command creates a worktree, opens a dedicated iTerm2 window with Claude Code on top and a shell on the bottom, and tracks everything.

The core commands:

  • wt create feature-branch: creates the worktree, checks out (or creates) the branch, and opens a split iTerm2 window ready to go.
  • wt list: shows all active worktrees with their status.
  • wt sync: pulls changes from main into your feature branch (merge or rebase, configurable).
  • wt merge: merges your feature branch to main, pushes, and auto-cleans up. Closes the iTerm2 window, removes the worktree, deletes the branch. Full lifecycle in one command.
  • wt feature-branch: shorthand to open or focus an existing worktree's window.

It also auto-approves Claude Code trust for new worktree directories, so you don't get that permissions prompt every time you spin up a new session.

Keep Your Own Tools

Now, every day, it seems someone is announcing a new AI orchestration framework that will spin up an army of Claude agents to do your bidding. I've found a lot of these are overkill, and require adopting a drastically new workflow, editor, or set of tools.

This was the key design decision. I didn't want to build a framework or an IDE plugin or some proprietary workspace concept. I wanted to keep using my editor, my terminal, my shell aliases, my git workflow, and just remove the friction around worktree management.

wt creates the worktree, sets up the window, and gets out of the way. You work however you normally work. Claude Code doesn't know or care that it's running in a worktree. Your test scripts don't care. Your build tools don't care. Everything just works because it's still a normal git checkout in a normal directory.

It started as a Zsh script that grew too complex, then I rewrote it in Go. You can install it via Homebrew:

brew install joescharf/tap/wt

Full documentation is at joescharf.github.io/wt.

Syncing and Merging

The sync and merge workflow is where wt saves the most time.

wt sync brings main into your feature branch. You choose merge or rebase in your config. If you hit conflicts, resolve them the way you normally would, then run wt sync again. It detects the in-progress merge or rebase and continues it. No need to remember whether you were mid-rebase or mid-merge.

wt merge handles the end of a feature's lifecycle. It merges your branch to main, pushes to the remote, then cleans everything up: removes the worktree directory, closes the iTerm2 window, and deletes the local feature branch. One command takes you from "feature complete" to "branch merged and cleaned up." No stale worktrees accumulating on disk, no orphaned branches cluttering your repo.

The Result

This is what actually made parallel development work for me. I run three or four Claude Code sessions at the same time (per project, no less), each on a different feature branch in its own worktree with its own iTerm2 window. One session is writing tests, another is refactoring a module, a third is building a new feature. They don't step on each other. When one finishes, I review it, wt merge, and it's on main.

After several hours of working on my projects in this parallel development mode, I was presented with the usage limit notification. Now I'm on the $200/month Max plan and cranking away on features and releasing projects in record time.

You can find the source code and installation instructions at github.com/joescharf/wt.