Tech Update / Adventures with Claude Code #8

Working in parallel with worktrees

Claude is working on feature A, the tests are running, and I'm sitting there waiting. Sound familiar?

The obvious idea: start a second Claude session. The problem: both work in the same directory, on the same branch, on the same files. That rarely ends well.

The solution is a Git worktree. A worktree is an additional working directory of the same repository with its own branch. The Git history is shared, the files are separate.

Claude Code has this built in:

claude --worktree ticket-4711
claude --worktree bugfix-login

Each call creates its own worktree and branch and starts a session inside it. Two Claudes, two branches, no conflicts. In the desktop app, every new session even gets its own worktree automatically.

What this brings day to day:

⚡ No waiting: while Claude A waits for the tests, Claude B is already building the next feature.
🧪 Compare approaches: have two solutions built in parallel and keep the better one.
🚑 Hotfixes without chaos: urgent bug comes in? New worktree, and your ongoing work stays untouched.
🧹 Cleanup included: worktrees without changes are removed automatically when you exit, and Claude Code asks if there are changes.

Honest notes from practice:

  • Hardly anyone can keep track of more than two or three parallel sessions. In the end, your own review is the bottleneck.
  • Tasks should be independent. Reworking the same file twice just moves the conflict to the merge.
  • Quick tip: add .claude/worktrees/ to your .gitignore.

My rule of thumb:

  • One task with tightly connected steps? One session.
  • Several independent tickets? Worktrees.

← Back to overview