claude-code - 💡(How to fix) Fix Mac app creating a new git worktree for every new chat session

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…

The macOS Claude Code app repeatedly created a new git worktree on every new chat session, resulting in 6 worktree directories and 9 orphaned claude/* branches, none of which contained any meaningful work. The worktrees appeared to be created at session start rather than in response to any explicit task that would require isolation.

Error Message

After the glitch, the project had:

  • 6 directories under .claude/worktrees/ (e.g. cranky-varahamihira-f5d379, epic-meitner-6b0ee1, frosty-kepler-772e5c, quirky-mirzakhani-e5ba24, upbeat-sinoussi, vibrant-robinson-119b4a)
  • 9 claude/* local branches, all pointing to the same commit as main or within 1-2 commits
  • Two of the directories were not even registered in git worktree list (fully orphaned)
  • None of the worktrees contained work that wasn't already reflected in the main working tree

Root Cause

The macOS Claude Code app repeatedly created a new git worktree on every new chat session, resulting in 6 worktree directories and 9 orphaned claude/* branches, none of which contained any meaningful work. The worktrees appeared to be created at session start rather than in response to any explicit task that would require isolation.

RAW_BUFFERClick to expand / collapse

Description

The macOS Claude Code app repeatedly created a new git worktree on every new chat session, resulting in 6 worktree directories and 9 orphaned claude/* branches, none of which contained any meaningful work. The worktrees appeared to be created at session start rather than in response to any explicit task that would require isolation.

Steps to reproduce

  1. Open a project in the macOS Claude Code app
  2. Open multiple new chat sessions (or the app glitches during session init)
  3. Each session creates a new .claude/worktrees/<name>/ directory and a corresponding claude/<name> branch

Observed behavior

After the glitch, the project had:

  • 6 directories under .claude/worktrees/ (e.g. cranky-varahamihira-f5d379, epic-meitner-6b0ee1, frosty-kepler-772e5c, quirky-mirzakhani-e5ba24, upbeat-sinoussi, vibrant-robinson-119b4a)
  • 9 claude/* local branches, all pointing to the same commit as main or within 1-2 commits
  • Two of the directories were not even registered in git worktree list (fully orphaned)
  • None of the worktrees contained work that wasn't already reflected in the main working tree

Expected behavior

Worktrees should only be created when a task explicitly requires isolation, not on every new chat open.

Environment

  • Claude Code version: 2.1.139
  • Platform: macOS (Darwin 25.4.0)
  • Invocation: macOS desktop app

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…

FAQ

Expected behavior

Worktrees should only be created when a task explicitly requires isolation, not on every new chat open.

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 Mac app creating a new git worktree for every new chat session