What
A worktree is a separate working copy of your project that Claude Code can create for a session. The checks and messages shown when you leave or remove one were reworked:
- The summary of what would be lost no longer runs a plain
git rev-list --countof commits. A new helper returns the commits plus anatStakerecord of what is at risk. It returns nothing when the branch to keep is unknown. - The exit dialog now handles a detached HEAD, which means the worktree is not on any named branch. It says "with HEAD detached" and "or the detached HEAD", and words differently whether commits will be lost or kept.
- New messages include "Worktree removed (no changes)" and a note that the worktree "is kept" when it was on another branch.
- Deleting a background session's worktree that contains other worktrees now gives its own reason,
worktrees_inside, instead of a generic failure. The message says "worktree may hold other worktrees - ctrl+x again deletes them" and tells you to move out anything you need first. - The usage report sent when a worktree is kept now includes the number of changed files and the at-stake details: the head state, the commits on the kept branch and the worktrees inside. Before, it sent only a plain commit count.
A new path that keeps the worktree at removal time (kept_at_removal) was added. In this build the function that decides it, eMe, always returns nothing, so that path never runs. The rewind dialog also gained a redesign branch that is switched off in the code itself and sets a subtitle.
Why
Exit warnings now describe more accurately what you stand to lose, including when HEAD is detached. A worktree that holds other worktrees is no longer deleted on the first try without a specific warning. The keep-at-removal behaviour is built but cannot be reached yet.