Claude CodeClaude Code 2.1 · macOS, Linux, Windows
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
31 small wins to finish your pathNext lesson

Worktrees: real parallel work

Two sessions in one directory edit the same files and ruin each other's afternoon. A worktree gives each one its own directory.

A git worktree is a second working directory for the same repository, on its own branch, sharing the history and the remote. Lesson 9 said a session belongs to a directory, so two directories mean two sessions that cannot collide.

bash
claude --worktree

It creates a worktree and a branch, then starts the session inside it.

From there it is an ordinary session. It has its own files, its own branch, and its own conversation. Merging is git, exactly as it would be for a colleague.

Which kind of parallel you want

ToolSplitsUse when
SubagentsContext, inside one sessionA side task whose output you do not want
WorktreesFiles, across directoriesTwo changes that would touch the same code
Agent viewWhole sessions, across a machineSeveral independent jobs to check on later
Agent teamsSessions that talk to each otherWork that has to be coordinated. Experimental

Most people need the first two. Reach for a worktree the moment you catch yourself waiting for one task to finish before starting an unrelated one.

What does not come with you
Worktrees need a git repository, and they are per branch. Untracked files your project needs, like a local .env, do not come along by default, which is the usual reason a fresh worktree cannot run your tests. A .worktreeinclude file lists what should be copied across, and a new worktree still needs its dependencies installed like any fresh checkout.
Try it yourself
  • Start claude --worktree for a small change and finish it there.
  • Run git worktree list afterwards and see what exists.
PreviousSubagents

Little by little, you're building something great.