<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Git Worktrees on Peter Fulop</title><link>https://peterfulop.tech/tags/git-worktrees/</link><description>Recent content in Git Worktrees on Peter Fulop</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><copyright>Peter Fulop</copyright><lastBuildDate>Sat, 21 Feb 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://peterfulop.tech/tags/git-worktrees/index.xml" rel="self" type="application/rss+xml"/><item><title>Claude Code now has built-in Git worktree support</title><link>https://peterfulop.tech/p/claude-code-git-worktrees/</link><pubDate>Sat, 21 Feb 2026 00:00:00 +0000</pubDate><guid>https://peterfulop.tech/p/claude-code-git-worktrees/</guid><description>&lt;img src="https://peterfulop.tech/p/claude-code-git-worktrees/claude-code-git-worktrees.jpg" alt="Featured image of post Claude Code now has built-in Git worktree support" /&gt;&lt;p&gt;Last week I wrote about &lt;a class="link" href="https://peterfulop.tech/p/ai-agents-git-worktrees/" target="_blank" rel="noopener"
&gt;how I develop multiple features at once with AI
agents and git
worktrees&lt;/a&gt;. The
whole thing was about setting up a hub-and-spoke model where each
feature gets its own directory and branch, letting you fire up multiple
agents in parallel without them stepping on each other&amp;rsquo;s files. It
worked well, but it involved a fair bit of manual ceremony &amp;mdash; bare
clones, config flags, naming conventions, cleanup.&lt;/p&gt;
&lt;p&gt;Then Boris Cherny, the creator of Claude Code at Anthropic,
&lt;a class="link" href="https://www.threads.com/@boris_cherny/post/DVAAnexgRUj/" target="_blank" rel="noopener"
&gt;announced&lt;/a&gt;
that they&amp;rsquo;re shipping built-in git worktree support directly in the CLI.
The Claude Desktop app has had a worktree checkbox for a while, but
bringing this to the command line is what makes it really interesting
for those of us who live in the terminal.&lt;/p&gt;
&lt;p&gt;As of this release, worktree isolation is now a first-class CLI feature.&lt;/p&gt;
&lt;h2 id="one-flag-instead-of-a-whole-setup-ritual"&gt;One flag instead of a whole setup ritual
&lt;/h2&gt;&lt;p&gt;In my previous article, getting worktrees going meant cloning as a bare
repo, configuring &lt;code&gt;core.bare&lt;/code&gt; and &lt;code&gt;core.worktree&lt;/code&gt;, initializing a main
worktree, then creating feature worktrees one by one. Not difficult, but
definitely something you had to learn once and then remember every time.&lt;/p&gt;
&lt;p&gt;With Claude Code&amp;rsquo;s built-in support, it&amp;rsquo;s one flag:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;claude --worktree feature-auth
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Claude creates a worktree (by default under something like
&lt;code&gt;.claude/worktrees/feature-auth/&lt;/code&gt;), checks out a dedicated branch
(e.g. &lt;code&gt;worktree-feature-auth&lt;/code&gt;) based on your default remote branch, and
drops you into an isolated session. Your main working directory stays
exactly as it was.&lt;/p&gt;
&lt;p&gt;Under the hood, this appears to map closely to &lt;code&gt;git worktree add&lt;/code&gt;
combined with session metadata that Claude manages separately. The
branch, filesystem isolation, and Git history are still standard Git
mechanics &amp;mdash; Claude just automates the ceremony around them.&lt;/p&gt;
&lt;p&gt;If you don&amp;rsquo;t care about naming, just let Claude pick one for you:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;claude --worktree
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;You&amp;rsquo;ll get something like &lt;code&gt;bright-running-fox&lt;/code&gt; &amp;mdash; random, but it keeps
the sessions distinct. The short flag works too, so &lt;code&gt;claude -w&lt;/code&gt; is all
you need when you just want quick isolation.&lt;/p&gt;
&lt;p&gt;You can also skip the command line entirely and ask Claude mid-session
to &amp;ldquo;work in a worktree&amp;rdquo; or &amp;ldquo;start a worktree,&amp;rdquo; and it will create one on
the fly.&lt;/p&gt;
&lt;h2 id="running-multiple-sessions-in-parallel"&gt;Running multiple sessions in parallel
&lt;/h2&gt;&lt;p&gt;The real value here is the same as what I described in my previous post
&amp;mdash; running several agents at once, each on its own task. The difference
is how little setup is involved now.&lt;/p&gt;
&lt;p&gt;Open a few terminal tabs and spin up separate sessions:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;span class="lnt"&gt;4
&lt;/span&gt;&lt;span class="lnt"&gt;5
&lt;/span&gt;&lt;span class="lnt"&gt;6
&lt;/span&gt;&lt;span class="lnt"&gt;7
&lt;/span&gt;&lt;span class="lnt"&gt;8
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Terminal 1 — auth refactor&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;claude --worktree feature-auth
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Terminal 2 — new API endpoint&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;claude --worktree new-api-endpoint
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Terminal 3 — test coverage&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;claude --worktree add-tests
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Each session gets its own copy of the codebase on its own branch. They
share the same Git history and remote, but the files on disk are
separate.&lt;/p&gt;
&lt;h2 id="cleanup-that-reduces-friction"&gt;Cleanup that reduces friction
&lt;/h2&gt;&lt;p&gt;In its current implementation, Claude Code handles much of this
automatically. When you exit a worktree session, it checks whether there
are changes in that workspace. If the worktree is clean, it may remove
the worktree and its associated branch. If there are changes, it prompts
you to decide whether to keep or remove it.&lt;/p&gt;
&lt;p&gt;One thing worth doing: add &lt;code&gt;.claude/worktrees/&lt;/code&gt; to your &lt;code&gt;.gitignore&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;.claude/worktrees/&amp;#34;&lt;/span&gt; &amp;gt;&amp;gt; .gitignore
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id="subagents-and-isolation"&gt;Subagents and isolation
&lt;/h2&gt;&lt;p&gt;From early demos and testing, subagents can also take advantage of
worktree isolation. This is still evolving, but it enables stronger
parallelism for large refactors.&lt;/p&gt;
&lt;h2 id="what-this-does-not-solve"&gt;What this does not solve
&lt;/h2&gt;&lt;p&gt;Worktrees eliminate file-level collisions. They do not eliminate
integration complexity. You still need reviews, rebases, and careful
merging.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pushing to remote.&lt;/strong&gt; Claude creates the worktree and branch locally,
but it does not push to the remote or open a pull request for you. Once
work in a worktree session is done, you still need to push the branch
yourself and create a PR. This is easy to forget when you have been
working across multiple worktrees at once.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git push -u origin worktree-feature-auth
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Full cleanup after merging.&lt;/strong&gt; The session-exit prompt handles the
simple case, but once you have pushed a branch, merged the PR, and no
longer need the worktree, there are a few manual steps left:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;span class="lnt"&gt;4
&lt;/span&gt;&lt;span class="lnt"&gt;5
&lt;/span&gt;&lt;span class="lnt"&gt;6
&lt;/span&gt;&lt;span class="lnt"&gt;7
&lt;/span&gt;&lt;span class="lnt"&gt;8
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Remove the worktree directory&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git worktree remove .claude/worktrees/feature-auth
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Delete the local branch&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git branch -d worktree-feature-auth
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;# Prune stale worktree references (optional, but tidy)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git worktree prune
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;None of this is difficult, but it is the kind of housekeeping that
accumulates if you spin up worktrees frequently and forget to clean up
after merging.&lt;/p&gt;
&lt;h2 id="the-friction-keeps-dropping"&gt;The friction keeps dropping
&lt;/h2&gt;&lt;p&gt;If you read my previous post and thought this sounded useful but
complex, this lowers the barrier:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;claude --worktree
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>How I develop multiple features at once with AI agents and git worktrees</title><link>https://peterfulop.tech/p/ai-agents-git-worktrees/</link><pubDate>Sun, 15 Feb 2026 00:00:00 +0000</pubDate><guid>https://peterfulop.tech/p/ai-agents-git-worktrees/</guid><description>&lt;img src="https://peterfulop.tech/p/ai-agents-git-worktrees/ai-agents-git-worktrees.png" alt="Featured image of post How I develop multiple features at once with AI agents and git worktrees" /&gt;&lt;p&gt;I&amp;rsquo;ve been running local coding agents like Claude Code for a while now, and one workflow change I&amp;rsquo;ve made lately isn&amp;rsquo;t about prompting or model selection. It&amp;rsquo;s &lt;code&gt;git worktree&lt;/code&gt;. Most engineers I talk to haven&amp;rsquo;t even heard of it, and I didn&amp;rsquo;t use it myself until a few months ago.&lt;/p&gt;
&lt;p&gt;I often have several independent features in flight on the same project at once — say a new feature, adding a new API endpoint, and creating test suites. All on separate branches. The old way of working? Check out a branch, start coding, get pulled into something else, stash everything or make some half-baked commit you&amp;rsquo;ll forget about, switch branches, lose your train of thought. You should be familiar with this.&lt;/p&gt;
&lt;p&gt;I use a clean &lt;strong&gt;hub + spokes&lt;/strong&gt; setup (one central repo, multiple worktrees): one folder is the &amp;ldquo;hub&amp;rdquo; (the bare repo and the main worktree), and each feature gets its own &amp;ldquo;spoke&amp;rdquo; worktree in a subfolder. Everything shares the same Git history and refs, but each spoke has its own working copy. More on the exact steps below.&lt;/p&gt;
&lt;p&gt;Stashing works fine when it&amp;rsquo;s just you. But when you have an AI agent mid-way through a refactor on your working tree and you need to switch branches — that&amp;rsquo;s where things get messy.&lt;/p&gt;
&lt;h2 id="what-git-worktree-actually-does"&gt;What git worktree actually does
&lt;/h2&gt;&lt;p&gt;It&amp;rsquo;s been part of Git for years (&lt;a class="link" href="https://git-scm.com/docs/git-worktree" target="_blank" rel="noopener"
&gt;official docs&lt;/a&gt;). The idea is simple: you can have the same repo checked out to multiple directories, each on a different branch, all at the same time. They share the same &lt;code&gt;.git&lt;/code&gt; internals — history, refs, everything — but each directory has its own working tree. This means they aren’t fully sandboxed, but in practice they’re isolated enough for parallel development.&lt;/p&gt;
&lt;h3 id="hub--spokes-setup"&gt;Hub + spokes setup
&lt;/h3&gt;&lt;p&gt;Do this once per project, in the folder you want to be the hub (e.g. &lt;code&gt;~/code/my-project&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. Clone as a bare repo into this folder:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git clone --bare git@github.com:your-org/your-repo.git .git
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;&lt;strong&gt;2. Configure the bare repo to allow worktrees:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git config --local core.bare &lt;span class="nb"&gt;false&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git config --local core.worktree .
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;&lt;strong&gt;3. Initialize the main worktree:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git worktree add main main
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;&lt;strong&gt;4. Create worktrees for features:&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git worktree add -b feature-auth auth-wt main
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git worktree add -b feature-new-api new-api-wt main
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git worktree add -b chore-add-tests tests-wt main
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Each &lt;code&gt;git worktree add -b &amp;lt;branch&amp;gt; &amp;lt;path&amp;gt; main&lt;/code&gt; creates a new directory, checks out a new branch based on &lt;code&gt;main&lt;/code&gt;, and puts the working copy there. You &lt;code&gt;cd&lt;/code&gt; into that directory and you&amp;rsquo;re on that branch. Your main worktree stays exactly as you left it — dirty files, staged changes, all untouched.&lt;/p&gt;
&lt;p&gt;I keep feature worktrees as sibling folders with a &lt;code&gt;-wt&lt;/code&gt; suffix (&lt;code&gt;auth-wt&lt;/code&gt;, &lt;code&gt;new-api-wt&lt;/code&gt;, &lt;code&gt;tests-wt&lt;/code&gt;). Nothing fancy, just consistent enough that I don&amp;rsquo;t lose track.&lt;/p&gt;
&lt;h2 id="where-it-gets-interesting-running-agents-in-parallel"&gt;Where it gets interesting: running agents in parallel
&lt;/h2&gt;&lt;p&gt;So instead of having one agent work on one branch while I sit and wait, I set up a worktree per feature and fire up an agent in each:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;span class="lnt"&gt;4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/code/my-project/main/ # my main checkout — quick fixes, reading code
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/code/my-project/auth-wt/ # Agent 1: auth refactor
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/code/my-project/new-api-wt/ # Agent 2: new endpoint or experiment
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;~/code/my-project/tests-wt/ # Agent 3: creating test suites
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;One terminal per worktree, one agent per terminal. They don&amp;rsquo;t know about each other, they can&amp;rsquo;t step on each other&amp;rsquo;s files, and I rotate between them checking output and steering as needed. My main directory stays clean the whole time.&lt;/p&gt;
&lt;h2 id="committing-pushing-and-cleaning-up"&gt;Committing, pushing, and cleaning up
&lt;/h2&gt;&lt;p&gt;Do all your git operations — &lt;code&gt;add&lt;/code&gt;, &lt;code&gt;commit&lt;/code&gt;, &lt;code&gt;push&lt;/code&gt;, &lt;code&gt;status&lt;/code&gt; — &lt;strong&gt;inside the worktree folder&lt;/strong&gt;, not in your main repo. Each worktree is a full working copy of its branch. If the agent&amp;rsquo;s changes live in &lt;code&gt;~/code/my-project/auth-wt/&lt;/code&gt;, that&amp;rsquo;s where you run git:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;span class="lnt"&gt;4
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/code/my-project/auth-wt
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git add .
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git commit -m &lt;span class="s2"&gt;&amp;#34;Add auth refactor&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git push origin feature-auth
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;When the feature is done and pushed, clean up the worktree. Run &lt;code&gt;git worktree remove&lt;/code&gt; from your main worktree (or the hub folder), pointing at the path you want to remove:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/code/my-project/main &lt;span class="c1"&gt;# your main checkout&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git worktree remove ../auth-wt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;That deletes the worktree folder. The branch and its commits stay in the repo and on the remote — you&amp;rsquo;ve already pushed them. You can merge the branch from your main checkout whenever you&amp;rsquo;re ready, or delete the branch after merging. The worktree was just a temporary workspace; removing it doesn&amp;rsquo;t touch the branch or its history.&lt;/p&gt;
&lt;h2 id="why-i-stuck-with-this-workflow"&gt;Why I stuck with this workflow
&lt;/h2&gt;&lt;p&gt;The parallel speed-up is obvious. But there are a couple of things I didn&amp;rsquo;t expect.&lt;/p&gt;
&lt;p&gt;In my experience, agents produce better results when they start from a clean state. No half-committed files from another branch, no untracked junk sitting around. The worktree gives each agent exactly what&amp;rsquo;s on that branch and nothing else. Sounds minor, but I noticed fewer confused outputs once I started doing this.&lt;/p&gt;
&lt;p&gt;When an agent goes sideways — and they do — I just nuke that worktree (after pushing anything worth keeping) and start over. It doesn&amp;rsquo;t affect anything else. Compare that to untangling an agent&amp;rsquo;s bad changes from your only working copy while trying to remember what was yours and what wasn&amp;rsquo;t.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve also started using this to compare approaches. Same branch point, two worktrees, two agents with different instructions. Diff the results, keep the one that&amp;rsquo;s better. Doing that without worktrees would be a pain involving branches, cherry-picks, and a lot of manual switching.&lt;/p&gt;
&lt;p&gt;And one thing people miss: my main checkout stays on &lt;code&gt;main&lt;/code&gt; through all of this. I&amp;rsquo;m never one absent-minded &lt;code&gt;git push&lt;/code&gt; away from shipping a half-finished experiment.&lt;/p&gt;
&lt;h2 id="worktree-habits-that-stuck"&gt;Worktree habits that stuck
&lt;/h2&gt;&lt;p&gt;Name your worktree directories after the branch. When you&amp;rsquo;ve got four terminals open, you need to know which is which immediately.&lt;/p&gt;
&lt;p&gt;Clean up when you&amp;rsquo;re done. &lt;code&gt;git worktree list&lt;/code&gt;, find the ones you don&amp;rsquo;t need, &lt;code&gt;git worktree remove&lt;/code&gt; them. Git won&amp;rsquo;t let you check out a branch that already has an active worktree elsewhere, and the error message it gives you isn&amp;rsquo;t great — so just stay on top of it.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git worktree list
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git worktree remove ../auth-wt
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Your editor won&amp;rsquo;t follow you — if you &lt;code&gt;cd&lt;/code&gt; into a worktree from the terminal, VS Code (or whatever you use) stays on your original directory. Open the worktree folder explicitly when you want to work there.&lt;/p&gt;
&lt;p&gt;Keep an eye on resource usage. Three agents running at once means three sets of API calls, three processes chewing through tokens. I check in every few minutes to make sure nobody&amp;rsquo;s going in circles.&lt;/p&gt;
&lt;h2 id="why-i-think-this-matters"&gt;Why I think this matters
&lt;/h2&gt;&lt;p&gt;In my setup, agents are getting good enough that the bottleneck isn&amp;rsquo;t just &amp;ldquo;can it do the task&amp;rdquo; anymore. It&amp;rsquo;s &amp;ldquo;how do I run several of them without everything colliding.&amp;rdquo; Git worktrees solve that at the filesystem level — no special tooling, no agent-specific setup, just Git giving each one its own workspace.&lt;/p&gt;
&lt;p&gt;I started doing this to get more out of coding agents on my projects. Now it&amp;rsquo;s just how I work when I&amp;rsquo;m developing multiple things at once. If you&amp;rsquo;re already using coding agents day to day, it&amp;rsquo;s one of the highest-leverage workflow changes I&amp;rsquo;ve found.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git worktree add -b &amp;lt;branch&amp;gt; &amp;lt;path&amp;gt; main
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git worktree list
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;git worktree remove &amp;lt;path&amp;gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Give it a shot next time you&amp;rsquo;ve got work happening on multiple branches.&lt;/p&gt;
&lt;h2 id="do-agents-already-use-worktrees"&gt;Do agents already use worktrees?
&lt;/h2&gt;&lt;p&gt;Many local and cloud-based coding agents operate in isolated copies of a repository — sometimes through full clones, temporary sandboxes, or other workspace mechanisms. Conceptually, this solves a similar problem to Git worktrees: allowing parallel changes without interfering with the main working directory.&lt;/p&gt;
&lt;p&gt;The advantage of setting up worktrees yourself is control. You can explicitly decide how to split the work and run different agents on different features in separate directories.&lt;/p&gt;
&lt;p&gt;For example, you might prefer one agent for frontend layout tasks and another for broader architectural changes. Managing the worktrees yourself lets you choose the right tool for each task, rather than relying on a single agent’s workflow.&lt;/p&gt;</description></item></channel></rss>