Git Work Trees are Awesome!

By Daniel Samson · 2026-03-07

Git worktrees are the feature I didn't know I needed until coding agents made me need it badly. If you're running an AI agent on one task and you want to do literally anything else at the same time, this is the answer.

One working directory is a bottleneck

The classic dance: you're mid-change, something urgent lands, so you stash, switch branch, wait for everything to rebuild, deal with the thing, switch back, unstash, and pray nothing got tangled. It's friction every single time. And it's far worse when an agent is halfway through editing files and you want to start a second piece of work — you simply can't, because you'd be standing on its toes.

Worktrees in one minute

A worktree is a second (or third, or tenth) working directory backed by the same repository. Same history, same remotes, different checkout.

git worktree add ../feature-x feature-x

That gives you a sibling folder on the feature-x branch. Work in it independently of your main checkout. When you're done, git worktree remove ../feature-x and it's gone.

Why it's a godsend with coding agents

Give each agent task its own worktree. Claude can churn away on feature A in one directory while you build feature B in another — or while a second agent works feature C in a third. No stashing, no branch-switching, no collisions. Each tree has its own files, its own state, its own dependencies if you want them. They just share the history underneath.

This very site was built that way: the agent works in a throwaway worktree, I review the diff, and the tree gets binned when the branch merges. Parallel work without the context-switch tax. Awesome is the right word.