claude-code - 💡(How to fix) Fix Support renaming the active worktree from within a Claude Code 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…

Root Cause

Renaming the branch alone (git branch -m) already works fine from inside a live session, but the folder name then drifts out of sync with the branch name. Renaming the folder itself currently requires ending the session, because git worktree move <old> <new> cannot operate on the directory a running session has as its working directory.

Fix Action

Fix / Workaround

  • Manual workaround: end the session, git worktree move, restart. Works, but breaks flow and loses in-session state that isn't persisted.
  • Rename branch only (git branch -m, already possible mid-session): keeps the session alive but leaves folder and branch names out of sync.
  • #54653 requests branch renaming mid-session and explicitly scopes itself to not touching the folder path. This request is the folder-side counterpart.
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

Claude Code creates a git worktree per session, which is great for parallel work. The worktree folder is named after the auto-generated branch (e.g. .claude/worktrees/beautiful-austin-3599ac/), and once a session is underway the user often wants a more meaningful name.

Renaming the branch alone (git branch -m) already works fine from inside a live session, but the folder name then drifts out of sync with the branch name. Renaming the folder itself currently requires ending the session, because git worktree move <old> <new> cannot operate on the directory a running session has as its working directory.

The result is either a stale folder name or an interrupted session — neither feels good when worktrees are otherwise designed for long-lived parallel work.

Proposed Solution

Two related improvements:

  1. A UI affordance to rename the current worktree. The Claude Code host could stop the session, run git worktree move <old> <new>, and restart the session pointed at the new path — making the rename feel atomic from the user's perspective.
  2. Allow Claude to rename its own worktree on request. Something like "rename this worktree to X" would trigger the same host-mediated stop / move / restart flow, so the rename can be driven conversationally rather than by leaving the session.

Both routes converge on the same host-mediated operation; only the trigger differs.

Alternative Solutions

  • Manual workaround: end the session, git worktree move, restart. Works, but breaks flow and loses in-session state that isn't persisted.
  • Rename branch only (git branch -m, already possible mid-session): keeps the session alive but leaves folder and branch names out of sync.
  • #54653 requests branch renaming mid-session and explicitly scopes itself to not touching the folder path. This request is the folder-side counterpart.

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

  1. Start a session — worktree is .claude/worktrees/beautiful-austin-3599ac/ on branch claude/beautiful-austin-3599ac.
  2. After describing the task, ask Claude (or click a UI button) to rename the worktree to worktree-rename-feature.
  3. Host stops the session, runs git worktree move .claude/worktrees/beautiful-austin-3599ac .claude/worktrees/worktree-rename-feature, then restarts the session in the new path.
  4. From the user's perspective, the rename is atomic — same conversation, new folder name.

Additional Context

Related: #54653 (branch rename mid-session) — this request is the folder-side counterpart. Together they would let users keep branch name, folder name, and task intent aligned without ending the session.

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 Support renaming the active worktree from within a Claude Code session