Unclear Exactly when a stopped session's worktree record is dropped is not clear.
What
A git worktree is a second working folder for the same repository. Claude Code creates one when you start it with --worktree, and agents can get their own. This release changes how worktrees are removed and how worktree problems are reported.
- Removal now first calls a new remover that checks the checkout before deleting anything. It only falls back to
git worktree remove --forcewhen the outcome is "unanchored". Before, it went straight togit worktree remove --force. - The remover reports one of four outcomes: removed, not_registered, refused or unanchored. A failed result carries the state of the checkout, and the check on the repository's git folder and root happens earlier.
- Agent worktree removal goes through the same remover. New messages include "refused before anything was deleted" and "its .git file is missing or does not point to git's record of it".
- An error about a worktree that belongs to a different repository no longer names the repositories.
- Cleanup can now drop the registration of a stopped entry (
dropIfStopped,deregisterIfStopped). The fallback log line now reads "falling back to removing the git worktree at" instead of "falling back to git worktree remove for". - When the branch is already checked out in another worktree, the error no longer names that worktree's path. It now says the branch "is already checked out elsewhere in this repository. Pass a different --worktree name."
- The "already exists" error and other creation failures now include git's own error message.
- Removal advice no longer gives ready-made
rm -rforgit worktree removecommands with paths in them. - The warning about a redirected checkout now names
~/.claude/skills. - When a worktree name collides, a new message says "The worktree registration for ... was left in place; pass a different --worktree name."
Why
Because the checkout is checked before anything is deleted, a removal that is refused leaves your files untouched. Cleanup of worktrees for stopped sessions may also remove more than before. When creating a worktree fails, the usual fix is now to pick a different --worktree name. The messages no longer hand you exact paths or commands to delete folders, so you get less path-specific guidance than before.
Exactly when a stopped session's worktree record is dropped is not clear.