claude-code - 💡(How to fix) Fix [FEATURE] Allow worktree branch renaming mid-session for meaningful git history [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#54653Fetched 2026-04-30 06:39:45
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2
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

Worktree branches are assigned random adjective-noun names at session start (e.g. worktree-mighty-sprouting-honey). At that point the user often hasn't described their task yet, so the name can't reflect the work. Once the session is underway and the intent is clear, there's no way to rename the branch.

This produces git history full of opaque branch names that convey nothing about what was done. Anyone reviewing the history — human or AI — has to read commit messages or diffs to understand what a branch was for. At scale (many worktree sessions across a team or even a solo developer), this makes branch-level history navigation meaningfully harder.

Proposed Solution

After describing their task, the user could ask Claude to rename the worktree branch to something brief and descriptive. Alternatively, a slash command (e.g. /rename-branch <name>) could do this directly.

Under the hood this is git branch -m plus updating the upstream tracking ref if already pushed. The worktree directory path doesn't need to change.

A natural UX: the user describes what they want to work on, Claude proposes a branch name (e.g. docs/claude-md-correctness-audit), and either applies it automatically or after confirmation.

Alternative Solutions

  • #42365 addresses the branch prefix (configurable worktree-claude/), which is complementary but doesn't solve naming based on task content.
  • #45211 requests creating named worktrees from the Desktop UI, which helps at creation time but not mid-session.
  • Manual git branch -m works but doesn't update the remote, and Claude Code isn't aware the branch was renamed — it can break push/MR workflows within the session.

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

  1. Start a Claude Code session with --worktree — branch is worktree-adjective-noun-noun
  2. Tell Claude: "audit CLAUDE.md for correctness and fix any errors"
  3. Claude does the work, then the user (or Claude) renames the branch to docs/claude-md-correctness-audit
  4. The commit, push, and MR all land under a descriptive branch name
  5. Months later, git branch --list or MR history is self-documenting

Additional Context

The worktree directory path (.claude/worktrees/<name>/) does not need to change — only the git branch name matters for history. This keeps the implementation simple since git supports renaming branches independently of worktree paths.

extent analysis

TL;DR

Implement a feature to rename worktree branches based on task content after the session starts, using git branch -m and updating the upstream tracking ref.

Guidance

  • Introduce a new command or UX flow that allows users to rename the worktree branch after describing their task, such as a /rename-branch <name> command.
  • Update the underlying git branch name using git branch -m and update the upstream tracking ref if the branch has been pushed.
  • Consider proposing a branch name based on the task description and applying it automatically or after user confirmation.
  • Ensure that the worktree directory path remains unchanged, as only the git branch name affects history.

Example

# Proposed command to rename the branch
/rename-branch docs/claude-md-correctness-audit

# Underlying git command to update the branch name
git branch -m worktree-mighty-sprouting-honey docs/claude-md-correctness-audit

Notes

The implementation should handle cases where the branch has already been pushed and ensure that the remote tracking ref is updated accordingly.

Recommendation

Apply a workaround by introducing a new command or UX flow to rename worktree branches, as this feature is not currently available and would greatly improve the usability of the git history.

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 [FEATURE] Allow worktree branch renaming mid-session for meaningful git history [1 participants]