[FEATURE] Allow worktree branch renaming mid-session for meaningful git history
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] 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 -mworks 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
- Start a Claude Code session with
--worktree— branch isworktree-adjective-noun-noun - Tell Claude: "audit CLAUDE.md for correctness and fix any errors"
- Claude does the work, then the user (or Claude) renames the branch to
docs/claude-md-correctness-audit - The commit, push, and MR all land under a descriptive branch name
- Months later,
git branch --listor 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.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗