Why not just open two terminals?

Two agents in the same folder edit the same files. One saves, the other saves over it, and neither notices. A git worktree fixes that: it's a second working folder with its own branch, sharing the same history as your project. Each agent gets its own, so their edits can't collide until you choose to merge them.

Before you start

  1. Make one commit. A worktree is created from an existing commit. In a project with none, Claude Code stops with Failed to resolve base branch "HEAD".
  2. Run Claude once in the project. Type claude in the project folder and accept the trust prompt. Without it, --worktree exits with an error.
  3. Ignore the worktrees folder. Add this line to .gitignore so the copies don't show up as new files in your main project:
    .claude/worktrees/
  4. Bring your secrets along. Files like .env are ignored by git, so a fresh worktree won't have them. Create a .worktreeinclude file at the project root, same syntax as .gitignore:
    .env
    .env.local

Start one agent per task

Open a terminal in your project and start the first agent with a name for its task:

claude --worktree contact-form

Claude Code creates the folder .claude/worktrees/contact-form/ on a new branch called worktree-contact-form, and starts the session there. Open a second terminal and do the same with another name:

claude --worktree pricing-page

The short form is -w. Each worktree is a fresh copy, so the first thing to ask each agent is usually to install the dependencies.

Pick tasks that don't overlap

Split by feature, not by layer. "Contact form" and "pricing page" touch different files. "Rewrite the database" and "add a field to the user profile" touch the same ones, and you'll spend the time you saved fixing merge conflicts. If two tasks depend on each other, run them one after the other.

Watch them all from one screen

Switching between terminals gets old fast. Claude Code has a view for this, in research preview:

claude agents

It lists your background sessions grouped by state: waiting for you, working, idle, done or failed. Press Space on a row to see the latest output and reply without leaving the list, Enter to open the full conversation, and ← on an empty prompt to go back. You can also send tasks straight to the background from a shell:

claude --bg --name "contact-form" "add a contact form that emails me"

To move a session you already have open into the background, type /bg in it. Background sessions keep running after you close the view or the terminal.

Prefer windows? Use the desktop app

In Anthropic's desktop app, press Cmd+N (Ctrl+N on Windows) for a new session and switch on Worktree before you send the first message. Worktrees land in the same .claude/worktrees/ folder. Open sessions side by side in split view, and review each one's changes in its Changes panel.

Review and merge one branch at a time

When an agent says it's done, look at what changed against your main branch before anything else:

git diff --stat main...worktree-contact-form

If it matches what you asked, open a pull request from inside the session ("create a pr"), or merge it yourself:

git switch main
git merge worktree-contact-form

Merge one, run your app, then merge the next. If the second branch conflicts with the first, ask its agent to update from main and resolve it: it knows its own changes best.

Clean up

When you leave a worktree session, Claude Code checks for unsaved work. A clean, unnamed worktree is removed with its branch. If there's work in it, you're asked whether to keep it, and Claude Code prints the command to come back later. To see and remove leftovers yourself:

git worktree list
git worktree remove .claude/worktrees/contact-form

Keep an eye on usage

Every session draws on your plan's quota independently, so four agents use it roughly four times as fast. Start with two or three, see how far your plan goes, and add more once you know.