[FEATURE] Option to disable automatic git worktree creation for linked repositories
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:
- A toggle in Settings: "Use git worktrees for branch isolation" (default: on)
- A per-session option when selecting a project: "Open in worktree" vs "Open directly"
- A
.claude/settings.jsonoption:"useWorktrees": false
Alternative Solutions
- 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
- Add a "Copy to original repo" command that syncs worktree changes back to the main repository location
- 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
- User has a local repository at
C:\code\my-projectlinked togithub.com/user/my-project - User selects "
user/my-project" from the Project Picker (which showsC:\code\my-projectas the local path) - User asks Claude to create a new feature
- Expected: Files created in
C:\code\my-project - Actual: Files created in
C:\Users\<user>\.claude-worktrees\my-project\random-branch-name - 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.
30 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
i want this feature, too (mac os)
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.
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.
I definitely want to disable automatic worktree creation in claude code (not the desktop app, the cli)
+1
Me too would strongly prefer this behavior as optional. Using MacOS desktop app here.
+1 - this is frustrating enough that it is making me consider using other tools
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.
Can't use Claude Code desktop app because of this - not all projects work with worktrees.
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:
@malvarezcastillo
This bug is really frustrating me, but finally the feature arrived
!Image
Until there's a setting to disable automatic worktree creation:
Workaround 1 — Use the CLI directly:
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:
Workaround 4 — Symlink trick (Windows):
If the worktree path is the issue, you can redirect it:
This redirects worktree creation to a different drive if space is a concern.
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.
Any progress on this?
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.
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.
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.
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.
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.
+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/Editoperate 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
claudeCLI from repo root as workaround — works, but loses the Desktop UI for the heaviest sessions.A project-level
.claude/settings.jsontoggle (e.g."createWorktree": false) covers both classes cleanly. Worktrees are the right default for some projects, just not all.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.
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 statusshows nothing despite Claude having done real work.Syncing remote changes mid-session. In a normal checkout, a teammate's push is a
git pull --rebaseaway. 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": falsein.claude/settings.jsonwould be enough, and the CLI already behaves this way by default.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" />
Just merged a change to default worktrees to off on Claude Code desktop. It will be out in Thursday's release.
@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?
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/)andCustom…. 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:
Proposal: add an
Off / Don't create worktreesoption 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.
GitHub automatically closed it, sorry about that.
@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
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/