[FEATURE] Option to disable automatic git worktree creation for linked repositories

Resolved 💬 30 comments Opened Jan 27, 2026 by dotanxmpie Closed May 19, 2026
💡 Likely answer: A maintainer (amorriscode, contributor) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

When selecting a repository from the Project Picker that is linked to a local folder, Claude Code automatically creates a git worktree (e.g., C:\Users\<user>\.claude-worktrees\<repo>\<branch-name>) instead of working directly in the selected local path. Users have no option to disable this behavior.

This causes confusion when users expect files to be created/modified in their actual project folder (e.g., C:\code\my-project) but instead find them in a hidden worktree location. It also adds friction for users who don't need branch isolation and simply want to work directly in their repository.

Proposed Solution

Add a setting (either global or per-project) to disable automatic worktree creation. When disabled, Claude Code should work directly in the local folder path shown in the Project Picker dropdown, without creating a separate worktree.

Possible implementations:

  1. A toggle in Settings: "Use git worktrees for branch isolation" (default: on)
  2. A per-session option when selecting a project: "Open in worktree" vs "Open directly"
  3. A .claude/settings.json option: "useWorktrees": false

Alternative Solutions

  1. Keep worktrees but make the behavior more transparent - show the actual working directory prominently in the UI so users know where files will be created
  2. Add a "Copy to original repo" command that syncs worktree changes back to the main repository location
  3. Use "Choose a different folder" as a workaround (current state), but this loses the GitHub integration benefits

Priority

Medium - Would be very helpful

Feature Category

Configuration and settings

Use Case Example

  1. User has a local repository at C:\code\my-project linked to github.com/user/my-project
  2. User selects "user/my-project" from the Project Picker (which shows C:\code\my-project as the local path)
  3. User asks Claude to create a new feature
  4. Expected: Files created in C:\code\my-project
  5. Actual: Files created in C:\Users\<user>\.claude-worktrees\my-project\random-branch-name
  6. User is confused when they can't find the files in their IDE or when git status in their original folder shows no changes

Additional Context

  • Platform: Windows 11
  • The worktree path format observed: C:\Users\<user>\.claude-worktrees\my-project\fervent-chatterjee
  • Worktrees are useful for some workflows, but should be opt-in rather than forced behavior for users who prefer direct repository access

Issue https://github.com/anthropics/claude-code/issues/12513 is closest to this feature request, but there it's considered as a bug, whereas here I'm raising a feature request to enhance the product.

View original on GitHub ↗

30 Comments

github-actions[bot] · 5 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/12513
  2. https://github.com/anthropics/claude-code/issues/2841
  3. https://github.com/anthropics/claude-code/issues/12932

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

gizmolab10 · 5 months ago

i want this feature, too (mac os)

sakal-s · 4 months ago

This is seriously frustrating. Every single session spawns a random worktree and branch (cranky-hertz, crazy-shaw, etc.) that I have to manually clean up. It's not a minor inconvenience — it's a constant distraction that breaks my workflow.

preferred_worktree_method: "disabled" in settings.json does absolutely nothing for the IDE app. There's no way to opt out. Solo developers are forced into a multi-branch workflow we never asked for, and we're left cleaning up garbage directories after every session.

This should be a simple toggle. The fact that it's been requested for months with no resolution is disappointing.
Please prioritize this — it's driving users away from the IDE.

andyjeffries · 4 months ago

How is this different to #12513?

It frustrates the hell out of me too (and I won't use the desktop app until it's fixed), but feels like it's split over two issues.

paralin · 4 months ago

I definitely want to disable automatic worktree creation in claude code (not the desktop app, the cli)

fabio-bergmann · 4 months ago

+1

victormoraisms · 3 months ago

Me too would strongly prefer this behavior as optional. Using MacOS desktop app here.

gleicher · 3 months ago

+1 - this is frustrating enough that it is making me consider using other tools

malvarezcastillo · 3 months ago

Has anyone found a workaround to block this? I like using worktrees but I create them manually and Claude seems to even want to nest them.

donce · 3 months ago

Can't use Claude Code desktop app because of this - not all projects work with worktrees.

dotanxmpie · 3 months ago
Has anyone found a workaround to block this? I like using worktrees but I create them manually and Claude seems to even want to nest them.

One way is to manually browse to a local folder, and avoid using the easy picker.

I also use this in my CLAUDE.md file, mostly when working with Claude Code in the command line. It's annoying that I need to do it, but this way I make sure it works where I actually expect it to work:

**Important File Location Rules**:
- **At the beginning of every session, ask the user: "What is the work folder for this session?"**
- Once the user provides a work folder, you have approval to create and modify files only within that folder.
- Default work folder (if not specified): `C:\code\my-project`
- If you are unsure about the location for new files, **ask the user first** before creating anything.

@malvarezcastillo

dyaskur · 3 months ago

This bug is really frustrating me, but finally the feature arrived

!Image

yurukusa · 3 months ago

Until there's a setting to disable automatic worktree creation:
Workaround 1 — Use the CLI directly:

cd /path/to/your/repo
claude

The CLI always works in your current directory without creating worktrees. This is the most reliable way to avoid the issue.
Workaround 2 — Use VS Code extension instead of Claude web:
The VS Code extension works in your VS Code workspace directory directly, not through the Project Picker flow that creates worktrees.
Workaround 3 — Clean up worktrees periodically:

git worktree list
git worktree remove ~/.claude-worktrees/repo/branch-name
rm -rf ~/.claude-worktrees/

Workaround 4 — Symlink trick (Windows):
If the worktree path is the issue, you can redirect it:

mklink /J "%USERPROFILE%\.claude-worktrees" "D:\claude-worktrees"

This redirects worktree creation to a different drive if space is a concern.

adrienthebo · 3 months ago

I manage my own worktrees. Claude managing worktrees would be a nice feature if I could opt-in, but this is frustrating behavior by default.

fadingtides · 2 months ago

Any progress on this?

Magmi183 · 2 months ago

Is it possible to configure Claude desktop app (Mac OS) not to auto-create branches, manage worktrees, etc.? I just want it to have opened a folder and that is it. I manage my own worktrees, branches, etc. The app is basically unusable because of this. Codex app is exactly how it should be done imo. Please bring us an option to disable all the git "smart" features.

bernieplug · 2 months ago

Our main use case is non-programmers using Claude Code + cli tools to query databases. Users don't understand git. Worktrees are incompatible their workflow. This will be a very common issue for non-programmers. We're using repo-level WorkreeCreate hooks to stop worktree creation, but it's delaying the start of every new session.

Please add a configuration option (available in settings.json) to disable use of Worktrees.

ThompsonSolutions · 2 months ago

Telling me to use CLI is not really an answer to the request we all have. Why build command line to work one way and then a GUI that creates more work and headach for end users.

kai00514 · 2 months ago

Switching from Cursor to the Claude Code Desktop app is difficult because automatic worktree branch creation causes confusion during sessions.

Please prioritize this issue and consider an early fix or an option to disable automatic worktree creation.

msnmanju · 2 months ago

The desktop app currently creates a claude/<name> worktree for every session against my repo, with no opt-out option. As a solo dev on a personal trading project, the worktree-per-session behavior has cost me real recovery time twice in the past 48 hours.
Concrete impact:

Two cherry-pick recoveries in two days: 3 commits the first time, 4 commits the second
Each recovery: identify which .claude/worktrees/<name>/ was the active one, git log to confirm, cherry-pick each commit onto the intended branch, resolve conflicts
26 orphaned .claude/worktrees/<name>/ directories accumulated; matching claude/* branches need separate cleanup
I only discovered the CLI runs in-place by default after digging into this issue thread.

As a workaround I'm switching my commit-intent sessions to the CLI. The desktop app stays for exploratory work. Not ideal — losing the desktop UI for the sessions I run most — but the cherry-pick tax is worse.
Happy to provide more detail on the workflow if useful.

404dotzero · 1 month ago

+1 — two concrete failure modes that aren't preference, they're structural:

Class 1: projects with gitignored content that's necessary for development. Design docs, internal task briefs, large test fixtures, generated reference data, scraped third-party docs — many real projects keep this directly in the repo tree but gitignored (too big, too sensitive, or local-only). The agent references these via memory and CLAUDE.md. Worktrees check out only tracked files, so the entire dev workspace appears empty inside the worktree. Agent hits expected paths → not found → starts confabulating context that should have been right there.

Class 2: projects integrated with external long-running tools (IDE sessions, build watchers, language servers, simulators, runtime processes) that hold the project open from one absolute path. Worktree creates a parallel file copy, but the live tool keeps reading the original. Now MCP tools and Read/Edit operate on two divergent file states, and the agent has no way to know which is the source of truth.

After 3 weeks: 28 orphan worktrees, multiple sessions wasted reasoning over stale or absent state. Switched to claude CLI from repo root as workaround — works, but loses the Desktop UI for the heaviest sessions.

A project-level .claude/settings.json toggle (e.g. "createWorktree": false) covers both classes cleanly. Worktrees are the right default for some projects, just not all.

dotanxmpie · 1 month ago
How is this different to #12513?

Issue #12513 is closest to this feature request, but there it's considered as a bug, whereas here I'm raising a feature request to enhance the product.

vkalladath · 1 month ago

Adding my voice here. A few pain points that compound the case for an opt-out:

CLI/Desktop parity gap. The CLI works in-place by default; the Desktop app silently redirects all writes to a hidden worktree. For anyone switching between the two, files appear to go missing and git status shows nothing despite Claude having done real work.

Syncing remote changes mid-session. In a normal checkout, a teammate's push is a git pull --rebase away. In a Desktop worktree, you're on a Claude-generated branch (claude/<random-name>) with unclear upstream tracking (see #36194), so you have to manually fetch and rebase — extra steps that shouldn't exist for a solo developer on an active team repo.

Orphaned state. Branches and .claude/worktrees/ directories accumulate, and session history gets fragmented across worktree-specific project folders (#53412).

Worktrees are genuinely useful for parallel sessions and sub-agent isolation — not asking for them to go away. A simple "useWorktrees": false in .claude/settings.json would be enough, and the CLI already behaves this way by default.

amorriscode contributor · 1 month ago

Worktrees are opt-in by selecting the "worktree" option in the composer. Will turn it off by default.

<img width="2386" height="390" alt="Image" src="https://github.com/user-attachments/assets/cd23b47a-65ce-42d2-b3c4-308ec14befad" />

amorriscode contributor · 1 month ago

Just merged a change to default worktrees to off on Claude Code desktop. It will be out in Thursday's release.

marcindulak · 1 month ago

@amorriscode - would it be possible to wait with closing bugs after the actual release is made, and link the fixing release number in the issue?

knurrrrrrt · 1 month ago

First, thanks for shipping the default-off change — it resolved a real workflow pain for me (solo dev, ~18 Swift app repos under one parent folder, lots of pinned per-repo sessions). Verified the new default with the Tuesday release: new sessions now open directly in the repo on the default branch, no .claude/worktrees/ created. Big quality-of-life improvement.

One small UI consistency follow-up I noticed after the rollout:

Settings → "Worktree location" still only offers Inside project (.claude/worktrees/) and Custom…. Both options describe a location — there's no way to express "I never want a worktree for this workspace, period." The actual enable/disable now lives in the composer per session.

For users who never want worktrees (which I'd guess is most users now that the default is off), this is confusing:

  • The "location" setting suggests a worktree will be created at the chosen location.
  • There's no single place to confirm or enforce "worktrees are off for this workspace."

Proposal: add an Off / Don't create worktrees option to the Worktree location dropdown. Selecting it would also disable the per-session composer toggle as the canonical workspace-level switch. The existing two options stay for users who do want worktrees.

Small change, but it would make the worktree story self-explanatory in one place. Thanks again for the default-off ship.

amorriscode contributor · 1 month ago
@amorriscode - would it be possible to wait with closing bugs after the actual release is made, and link the fixing release number in the issue?

GitHub automatically closed it, sorry about that.

aparajita · 1 month ago

@amorriscode What about the CLI? You have rendered subagents completely unreliable (and thus useless) for solo developers. I really have to wonder how carefully you (or Claude) think through the "features" which just break things. The age of AI coding has made developers reckless.

@bcherny

snailwei · 4 days ago

The AI + workthree can easily run into a mess, look at my nested project, 001, 004 should be in the same level.
.claude/worktrees/004-am-asr-combined/001-ml-gap-refined/