claude-code - 💡(How to fix) Fix Desktop app: add project-level setting to opt out of automatic git worktree creation

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

When a session crashes (e.g. due to an MCP connector schema error), the worktree directory and claude/<name> branch are orphaned. I have to manually clean them up with git worktree remove and git branch -d. This has happened repeatedly.

Fix Action

Fix / Workaround

  1. Unexpected file duplication — a full mirror of the entire project directory is created under .claude/worktrees/<random-name>/ on every session open. For a project like mine that lives in Dropbox, this means the full directory tree syncs to the cloud on every session, including all subfolders (memory files, chat logs, digests, etc.).
  2. Orphaned directories and branches on crash — when a session crashes or is force-quit, both the worktree directory and the claude/<name> branch are left behind. The user has to manually run git worktree remove and git branch -d to clean up. Normal session exits clean up correctly, but crashes are common enough (e.g. MCP connector schema errors that make every message fail) that this becomes a recurring maintenance task.
  3. Inconsistent behavior — non-git projects run directly from the opened directory as expected. Git projects silently get a worktree. This inconsistency is confusing and non-obvious. The CLI (claude from terminal) does not create worktrees automatically — it runs in-place. Only the desktop app does this. Switching to the CLI is not a viable workaround for users who depend on desktop app features.

The only workaround is to use the CLI (claude from terminal) instead of the desktop app, which runs in-place without creating worktrees. This is not viable for users who rely on desktop app features.

Code Example

{
  "worktree": {
    "autoCreate": false
  }
}
RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

Problem Statement

The Claude Code desktop app automatically creates a git worktree for every new session when the project is a git repository. There is no setting to disable this behavior.

This causes several problems:

  1. Unexpected file duplication — a full mirror of the entire project directory is created under .claude/worktrees/<random-name>/ on every session open. For a project like mine that lives in Dropbox, this means the full directory tree syncs to the cloud on every session, including all subfolders (memory files, chat logs, digests, etc.).
  2. Orphaned directories and branches on crash — when a session crashes or is force-quit, both the worktree directory and the claude/<name> branch are left behind. The user has to manually run git worktree remove and git branch -d to clean up. Normal session exits clean up correctly, but crashes are common enough (e.g. MCP connector schema errors that make every message fail) that this becomes a recurring maintenance task.
  3. Inconsistent behavior — non-git projects run directly from the opened directory as expected. Git projects silently get a worktree. This inconsistency is confusing and non-obvious. The CLI (claude from terminal) does not create worktrees automatically — it runs in-place. Only the desktop app does this. Switching to the CLI is not a viable workaround for users who depend on desktop app features.

Proposed Solution

Add a project-level setting in settings.json to disable automatic worktree creation:

{
  "worktree": {
    "autoCreate": false
  }
}

When autoCreate is false, the desktop app would run the session directly from the opened directory, matching the CLI behavior. The existing sparsePaths option would still work when worktrees are manually invoked.

Alternatively, a global setting in ~/.claude/settings.json with a per-project override would also satisfy the use case.

Alternative Solutions

The only workaround is to use the CLI (claude from terminal) instead of the desktop app, which runs in-place without creating worktrees. This is not viable for users who rely on desktop app features.

Currently working around it with periodic manual cleanup: git worktree remove for orphaned directories and git branch -d claude/* for leftover branches after session crashes.

Priority

Medium - Would be very helpful

Feature Category

Configuration and settings

Use Case Example

I open Claude Code desktop app on a git repository (a personal knowledge management kit that lives in Dropbox). Every session creates a new worktree at .claude/worktrees/<random-name>/ containing a full mirror of my project. Since it's in Dropbox, the entire tree syncs to the cloud on every session open.

When a session crashes (e.g. due to an MCP connector schema error), the worktree directory and claude/<name> branch are orphaned. I have to manually clean them up with git worktree remove and git branch -d. This has happened repeatedly.

With worktree.autoCreate: false in my project's settings.json, the session would run directly from my project directory — matching how the CLI behaves and how non-git projects already work in the desktop app.

Additional Context

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Desktop app: add project-level setting to opt out of automatic git worktree creation