Skip to content
86% off$349 $48.86code BF2026

Guides

claude --worktree doesn't create a git worktree: workarounds

claude --worktree (-w) not creating a git worktree? Check it, make one with git worktree add, or let Sledbot create one per task.

GuideUpdated 6 min read

On this page

You ran claude --worktree (or claude -w) and nothing seemed to happen. pwd is unchanged, git worktree list shows one entry, and .git is still a directory. This page covers how to confirm that, two reliable workarounds, and what to check if those fail too.

Why it happens

We don't know the cause, and we can't say it is a single bug. Anthropic's support site describes the flag as a supported feature: from the CLI, claude --worktree (or claude --worktree my_worktree) starts a session in an isolated worktree. So the feature exists, and this page is about the cases where it doesn't behave that way.

People on the Claude Code issue tracker report the symptoms above on version 2.1.49, on macOS and on Ubuntu, with the last report in February 2026. The thread we found shows no fix. We haven't re-tested newer versions, so treat newer builds as unknown.

Things that can look like a failure without being one:

  • Your shell never changes directory. A program you launch can't change your shell's pwd. Check from inside the Claude session or with git worktree list instead of trusting the prompt in your original terminal.
  • You aren't in a git repository. Worktrees need git. Anthropic's tips page says for non-git VCS such as Mercurial, Perforce or SVN, you define WorktreeCreate and WorktreeRemove hooks in settings.json to get similar isolation.
  • An older Claude Code build. If you are on a build from before the flag shipped or stabilized, it may not do what the docs describe. Update and retry.

Check whether a worktree was created

Run these from the original repo folder, in a second terminal tab if the Claude session is still open:

bash
git worktree list
git rev-parse --show-toplevel

git worktree list prints one line per worktree. If you see only your repo path, nothing was created. The .git check also works: in a linked worktree .git is a small file pointing back to the main repo, and in the main checkout it is a directory.

You can also check the version with claude --version.

Fix 1: create the worktree yourself

This works on any git repo and any Claude Code version.

  1. Go to your repo: cd ~/Developer/myrepo

  2. Create a worktree on a new branch, in a sibling folder:

    bash
    git worktree add -b fix-login ../myrepo-fix-login main

    This creates branch fix-login from main and checks it out in ../myrepo-fix-login. Use any base branch in place of main.

  3. Move in and start the agent:

    bash
    cd ../myrepo-fix-login
    claude
  4. Check it: git worktree list now shows two lines.

Remove it when you're done

Run these from the main repo after the work is merged or abandoned:

bash
git worktree remove ../myrepo-fix-login
git branch -d fix-login

git worktree remove refuses to delete a worktree with uncommitted changes. --force discards them, so leave it off unless you mean it. git branch -d refuses to delete an unmerged branch. git branch -D deletes it anyway, along with any commits that exist only on that branch.

What a new worktree doesn't have

A worktree is a fresh checkout. Files git doesn't track, such as .env, node_modules and build output, are missing. Copy or reinstall them before the agent runs tests. Git also refuses to check out the same branch in two worktrees at once, so give each task its own branch.

Fix 2: let Sledbot create one per task

If you start several agents regularly, the manual route gets repetitive. Sledbot creates the worktree itself when you start a task, then launches the agent inside it. It doesn't repair the -w flag; it just doesn't rely on it.

  1. Choose File ▸ Add Project Folder… (⌘O) and pick your git repo. It becomes a space in the sidebar.
  2. Press ⌘T (Command-T) to open New task.
  3. Describe the task. In the agent chip, pick Claude Code. It is the default unless you last used another agent. If it isn't installed on this Mac, the chip offers Install….
  4. Check that Work in a new worktree is on. It is on by default for git repos. Edit the branch name if you don't want the suggested agent/… one.
  5. Press ⌘↩ (Command-Return). Progress reads Creating worktree, then Launched Claude Code, then Waiting for the agent.

The worktree is created at <repo>/.sledbot/worktrees/<branch>, with / in the branch name replaced by -. Sledbot adds .sledbot/ to .git/info/exclude, so git doesn't track the folder. To see where an agent runs, open its session page and check Folder in the details rail.

Setup scripts and ports

Sledbot reads scripts from .sledbot/config.json (or sled.json) at the repo root. For example:

json
{"setup": ["npm ci"], "copy": [".env"], "run": "npm run dev -- --port $SLED_PORT", "archive": "docker compose down"}

Replace the commands with your project's own. Terminals in a worktree get SLED_PORT, SLED_WORKTREE, SLED_ROOT and SLED_BRANCH. The setup and copy entries cover the missing-dependencies problem described above. From the command line, sled worktree info|create|setup|run|archive drives the same scripts, and sled worktree create --branch <name> makes a worktree from a branch (it also takes --issue N or --pr N).

Run several at once

Agents ▸ Compare Agents… runs the same task with 2 to 4 agents, each in its own worktree on a branch named compare/<slug>-<agent>-<n>. It needs a git repo. For separate tasks, repeat ⌘T.

Review and clean up

Closing a running agent stops it, but its worktree and files stay. Before merging, Review changes shows the agent's diff against the base branch, hunk by hunk. Remove old worktrees from a space's context menu with Clean up worktrees….

Sledbot is part of MacSuite and runs for 7 days without a key. Starting agents after the trial needs a license ($349 one-time, as of November 2026; see pricing). It needs macOS 14 or later.

Which option to use

OptionUse it whenTrade-off
Update Claude Code, retry -wYou run one agent now and thenMay still fail; cause unconfirmed
git worktree add by handYou want no extra softwareYou create, copy files into and remove each one
Sledbot New taskYou start many agents or review each branch before mergingNeeds a MacSuite license after the 7-day trial

Checklist before you try again

  • You are inside a git repo with at least one commit.
  • claude --version shows a recent build, and you've updated it.
  • You checked git worktree list from the original repo, not just your prompt.
  • The branch name you chose isn't already checked out in another worktree.
  • The target folder doesn't already exist.

Errors you might hit

  • git worktree add says the branch already exists. Drop -b and pass the existing branch name, or pick a new name.
  • Git says the branch is already checked out in another worktree. Run git worktree list to find where, then use a different branch or remove that worktree.
  • The target path already exists. Choose a new folder name.
  • Sledbot shows "Couldn't create the worktree". Read the detail after the colon.
  • Sledbot shows "Not a valid branch name". Edit the branch field or choose Use suggested name.
  • Sledbot says the space isn't a git repository. Run git init and make a first commit, or turn off Work in a new worktree.

If nothing works

For the flag itself, report it to Anthropic through Claude Code's own feedback channel or the project's issue tracker. For Sledbot, use support. Include the output of claude --version, git --version, git worktree list, your macOS version, and the exact command you ran.

text
Subject: claude --worktree does not create a git worktree

Claude Code version: (output of claude --version)
macOS: (version)
Command: claude --worktree
Result: git worktree list shows only the main repo path; .git is a directory.
Repo: normal git repo with at least one commit.
Tried: updated Claude Code, ran inside the repo root, created the worktree manually with git worktree add.

Common questions

Does git worktree add work with Claude Code?

Yes. Claude Code runs in whatever directory you start it in, so launching claude inside a linked worktree gives you an isolated checkout.

Can two agents share one branch?

Not in two worktrees at once, because git refuses it. Give each agent its own branch and merge afterward.

Do I need Sledbot for worktrees?

No. Plain git is enough for a few worktrees. Sledbot helps when you create and review many of them.

For more on running agents side by side, see running multiple Claude Code agents in parallel, Claude Code worktrees and Start an agent on a task. Anthropic's Claude Code power user tips page describes the --worktree flag.

Every app.
One purchase.