[BUG] Worktree exit warning claims branch will be deleted, but branch persists after removal
Resolved 💬 2 comments Opened Feb 25, 2026 by ebizboy Closed Mar 25, 2026
Bug Description
When exiting a worktree session (claude -w), the warning dialog states:
"The branch will be deleted if you remove the worktree."
However, after selecting "Remove worktree", the worktree directory is deleted but the branch remains.
This also happens with manual git worktree add / git worktree remove — which is expected git behavior (git does not auto-delete branches on worktree removal). So the warning message is misleading.
Steps to Reproduce
- Run
claude -wto start a worktree session - Make at least 1 commit
- Exit the session (Ctrl+C or
/exit) - Select "Remove worktree" from the prompt
- Run
git branch— the worktree branch still exists
Expected Behavior
Either:
- Option A: Actually delete the branch when removing the worktree (match the warning message)
- Option B: Update the warning message to not claim the branch will be deleted (match the actual behavior)
Actual Behavior
- Worktree directory is removed ✅
- Branch persists ❌ (contradicts the warning)
Screenshot
The exit dialog showing the misleading message:
Exiting worktree session
You have 1 commit on worktree-quiet-meandering-ullman. The branch will be deleted if you remove the worktree.
1. Keep worktree Stays at /Users/.../worktrees/quiet-meandering-ullman
> 2. Remove worktree All changes and commits will be lost.
Environment
- macOS (Darwin 25.3.0)
- Claude Code CLI (
claude -w)
Related
- #26725 (Stale worktrees are never cleaned up) — related but different: that issue is about worktrees not being removed; this issue is about branches not being removed when worktrees are removed.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗