claude-code - 💡(How to fix) Fix Seamless local multi-branching: parallel sessions currently conflict on the working tree [1 participants]

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…
GitHub stats
anthropics/claude-code#52051Fetched 2026-04-23 07:37:52
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
1
Participants
Timeline (top)
labeled ×2
RAW_BUFFERClick to expand / collapse

Problem When I run two Claude Code sessions in parallel on the same repo (common: one implementing, one reviewing / exploring), they step on each other's working tree — uncommitted edits collide, one session's branch switch breaks the other, etc. I end up with repo states I didn't intend.

Proposal Make multi-session the happy path, not something I have to manually plumb with git worktrees. Concretely:

  • Launching a second session on the same repo should auto-provision an isolated worktree + branch under a predictable path (.claude/worktrees/<session-id>/).
  • The session UI should surface which worktree/branch it's attached to so I never mix them up.
  • Merging / discarding a session's worktree back into the main checkout should be a one-command operation.

(I see there's already some EnterWorktree primitive — this ask is about making it the default multi-session experience, not an opt-in advanced mode.)

Why it matters Parallel sessions are the single biggest productivity unlock of this product, and today they're also the single biggest source of "wait, why is my repo in this state" confusion.

extent analysis

TL;DR

To avoid conflicts between parallel Claude Code sessions, consider utilizing the existing EnterWorktree primitive to create isolated worktrees for each session.

Guidance

  • Investigate the EnterWorktree primitive to understand its capabilities and limitations in creating isolated worktrees.
  • Explore the possibility of automating the creation of a new worktree and branch for each new session, using a predictable path like .claude/worktrees/<session-id>/.
  • Consider adding a UI indicator to display the current worktree and branch for each session, to prevent mix-ups.
  • Develop a one-command operation for merging or discarding a session's worktree changes into the main checkout.

Example

No code snippet is provided as the issue does not contain specific implementation details.

Notes

The proposed solution relies on the existing EnterWorktree primitive, which may have limitations or requirements that need to be understood before implementing the suggested changes.

Recommendation

Apply workaround: Utilize the EnterWorktree primitive to create isolated worktrees for each session, as this seems to be the most straightforward way to address the issue without waiting for a potential built-in multi-session support.

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