Imagine two tickets in a Kotlin backend. One adds a status filter to a search endpoint. The other documents pagination. Both start from the same repository. If two Claude Code sessions work in the same directory, one can read a file while the other edits it. Even a git diff becomes ambiguous. Which ticket does that line belong to?

With Git worktrees, each session works in its own directory and on its own branch. They share Git history. Both tickets can move forward, and each diff can be reviewed on its own.

When parallel work pays off#

I start by looking at the dependencies between tickets. The filter can move ahead if the pagination docs only describe the existing API contract. If the first ticket also changes the order of results, I prefer to settle that contract before asking someone to document it. Two diffs can merge cleanly and still describe incompatible behavior.

text
                    Shared base
                    /         \
                API filter    Pagination docs
              Focused tests   Proofread
                    \         /
                 Review both diffs
                         |
                Test after integration

Start two Claude Code sessions#

From the Git repository root, in two separate terminals:

bash
# Terminal 1
claude --worktree status-filter
 
# Terminal 2
claude --worktree pagination-docs

Claude Code opens each session in a worktree under .claude/worktrees/. Before starting both sessions, I check the expected base commit. Uncommitted local changes in the main directory won't automatically appear in the worktrees. The Claude Code worktree documentation covers creation options and how to choose the base branch.

It's also worth checking what the two sessions share outside Git. Two integration tests can interfere if they reset the same database. Two local servers need different ports. For this example, I give each session its own disposable test database if needed, then check the local settings before running tests.

Give each session a clear stopping point#

I give the first session the behavior to prove and the second a source of truth for the documentation.

TicketDone whenEvidence
Status filterThe filter selects the right status. Omitting it preserves existing behavior.Tests for both cases and the code diff
DocumentationAn example shows how to get the next page using the existing API.Example checked against the current contract and tests

I ask each session to summarize the files it touched, the checks it actually ran, and any open questions. If a shared change surfaces, I decide whether it belongs in scope before extending either ticket. Plan mode helps make that decision early.

Review before bringing the branches together#

In each worktree, git status --short and git diff HEAD show tracked local changes and flag untracked files. I read those new files too, then review any ticket commits against the starting commit. Claude's summary serves as a table of contents for the review.

Once both changes are integrated, I run the checks against the combined result. Here, I replay the pagination example with the filter enabled. Two green branches can still hide a change in ordering that breaks the example.

Subagents are useful when I want to hand off reading or analysis within one session. Two worktrees are useful when I want two changes that can be integrated independently. To decide whether the process is worth repeating, I look at review time and rework. That's the starting point for evaluating an agentic workflow.