claude-code - 💡(How to fix) Fix Feature request: allow updating git branch display mid-session (worktree support) [1 comments, 2 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#47159Fetched 2026-04-13 05:39:53
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1
RAW_BUFFERClick to expand / collapse

Problem

When working with git worktrees created mid-conversation, the UI continues showing the branch from the primary working directory (set at session start). There's no way to update the displayed branch to reflect the active worktree's branch.

Use case

My project is a Unity game with ~3.3 GB of binary assets. Creating a full worktree for each parallel task is too slow and wastes too much disk space. Instead, I use sparse worktrees that check out only source files (~7 MB of .cs files), which makes parallel agent work practical.

The workflow:

  1. Start a Claude Desktop session from the main project directory (on main)
  2. Ask Claude to create a sparse worktree with a new branch via a script
  3. All subsequent work happens in the worktree on the new branch

The problem is that the UI keeps showing main for the entire session, even though all git operations are happening on a different branch in the worktree. There's no MCP tool or programmatic way to update the displayed branch mid-session.

Suggestion

Allow updating the primary working directory or at least the displayed git branch during a conversation — e.g., via a tool call, MCP, or automatic detection when git commands consistently target a different worktree.

extent analysis

TL;DR

Update the primary working directory or displayed git branch during a conversation to reflect the active worktree's branch.

Guidance

  • Investigate the possibility of using a tool call or MCP to update the displayed branch, as suggested in the issue.
  • Explore automatic detection of git commands targeting a different worktree to trigger an update of the displayed branch.
  • Consider modifying the workflow to create a full worktree for each parallel task, if disk space and performance constraints allow.
  • Review the current implementation of sparse worktrees to ensure they are correctly configured and functioning as intended.

Example

No code snippet is provided, as the issue does not contain specific code examples.

Notes

The issue is specific to the use of sparse worktrees and the limitations of the current UI implementation. The suggested solution may require modifications to the underlying tooling or workflow.

Recommendation

Apply workaround: Implement a custom solution using a tool call or MCP to update the displayed branch, as the issue suggests that the current implementation does not support updating the primary working directory or displayed git branch during a conversation.

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