Running four repositories in the same morning window
Running four technical blogs as an indie developer, there are mornings when I want to touch several repositories at once. claudelab, gemilab, antigravitylab, rorklab — each is its own repository, yet I often want to apply similar fixes across them in parallel.
The old way meant switching Git branches, and every switch triggered a rebuild and a wait for dependencies to resolve. Move from a bug fix in one session to a feature in another, and my hands stopped each time.
Since I started using Claude Code's Worktree feature, that waiting has all but disappeared. Each branch lives in its own directory, and separate sessions run side by side. This article gathers what I learned running them in parallel — including where I tripped up.
Understanding Git Worktree
What is Worktree?
Git Worktree lets you create multiple working directories from a single repository, each checking out a different branch independently.
Traditional approach (branch switching):
main ← checkout → feature-A
↓ (time-consuming)
feature-B ← checkout
With Worktree:
main/ ← ~/project-main
feature-A/ ← ~/project-feature-a (independent directory)
feature-B/ ← ~/project-feature-b (independent directory)
Each worktree is isolated, enabling simultaneous work across branches without switching delays.
Key Benefits
- Parallel Development: Work on multiple branches simultaneously
- Fast Switching: Just change directories (no checkout needed)
- Resource Efficiency: Each worktree can maintain independent dependencies
- CI/CD Integration: Build and test multiple branches in parallel
Learn it by hand first — git worktree add
Before reaching for Claude Code's convenience flags, run the plain Git command by hand once. Everything that follows makes more sense afterward, and this is the foundation of parallel development.
# Run from the root of the repository that holds main
# Create a worktree for feature/search in a sibling directory
git worktree add ../project-feature-search feature/search
# Use -b to create the branch at the same time if it doesn't exist yet
git worktree add -b feature/pagination ../project-feature-paginationMove into the new directory and launch Claude Code there.
cd ../project-feature-search
claudeOnce "open one more Claude Code in a separate directory" feels natural, the flags are just shortcuts. Since this relies only on plain Git, it works reliably in any environment.
The --worktree Flag
Claude Code shipped built-in Worktree support in v2.1.49 (February 2026). The --worktree flag (short form -w) automatically creates a worktree for a given branch and starts the session inside it.
claude --worktree feature/auth-systemThis command automatically:
- Creates a worktree for
feature/auth-systemfrom your current repo - Launches Claude Code in the new directory
- Runs code edits and file operations within that worktree
Basic Usage Examples
Example 1: Feature Branch Development
# Create a worktree for feature/user-dashboard
claude --worktree feature/user-dashboardExample 2: Parallel Bug Fixes
# Fix API timeout issues
claude --worktree hotfix/api-timeout
# In a separate terminal, work on pagination
claude --worktree feature/paginationThe desktop app creates a worktree automatically
If you use the Claude Code desktop app instead of the terminal, every new session gets its own worktree automatically — no -w flag needed. Because sessions never touch each other's files, you can build a feature in one and fix a bug in another without collisions.
Managing Worktrees
List Existing Worktrees
git worktree listSample output:
/home/dev/project abc1234 [main]
/home/dev/project-feature-auth def5678 [feature/auth-system]
/home/dev/project-feature-dash ghi9012 [feature/user-dashboard]
Remove a Worktree
Once work is complete, remove the worktree:
git worktree remove ../project-feature-authIf only a stale reference remains, clean it up with:
git worktree pruneKnow the auto-cleanup conditions
Worktrees that Claude Code created for subagents and background sessions are removed automatically once they are older than your cleanupPeriodDays setting. But this only happens when there are no uncommitted changes, no untracked files, and no unpushed commits.
That condition is quiet but matters in practice. Leave logs or build output inside a worktree and it counts as untracked, so it falls outside auto-cleanup and old worktrees quietly pile up. Rather than leaning entirely on automation, I recommend taking stock with git worktree list at each stopping point.
Isolation Mode
Claude Code's Worktree supports Isolation Mode, which fully separates environments between worktrees.
What Isolation Mode Provides
Isolation Mode gives each worktree its own independent:
node_modulesdirectory.envfiles- Build artifacts (
dist/,build/, etc.) - Server processes (running on different ports)
Enabling Isolation Mode
claude --worktree feature/payments --isolationEnvironment Variable Separation Example
# main worktree
cd ~/project
export API_KEY="prod-key-main"
export PORT=3000
# feature/payments worktree
cd ~/project-feature-payments
export API_KEY="dev-key-payments"
export PORT=3001 # Different portThis lets you run multiple development environments at once.
Where I tripped up in parallel — living with disk space
Running four repositories side by side with worktrees, the first wall I hit was disk space.
In Isolation Mode, node_modules is duplicated per worktree. Behind the convenience, the dependency tree grows with every repository. One morning, my automated update run halted with ENOSPC (No space left on device). Tracing it back, a few old worktrees I had forgotten to remove had quietly filled the disk.
So I tightened the workflow:
- Remove a worktree with
git worktree removethe moment it's done. "I'll clean it later" is the entrance to the pile-up. - For dependency-heavy repositories, cap how many run in parallel. Don't open them all — only expand the ones you'll touch that morning.
- Where you rely on auto-cleanup, design around leaving no untracked files (move logs to a separate directory).
The number of parallel sessions isn't "as many as you can spin up" — it's a number you settle with your disk. Once I saw it that way, the stalls stopped.
A first step
Start by running git worktree add once on a repository you already have, and open one more Claude Code in the separate directory. When you feel two sessions advance without touching each other's files, scaling up the parallelism becomes a natural next move.
For me, one branch was all I could handle at first; now I run four repositories in the same morning window. I hope this helps with your own setup — thank you for reading.