A git worktree is an extra working folder tied to the same repository, and git keeps a record of each one. When Claude Code removes the record of a worktree that no longer exists, on Linux and WSL it now:
- Renames the record into a
worktrees/claude-dropped-*folder. - Checks that the moved folder is the one it meant to remove.
- Empties it there.
Before, it deleted the record in place. Claude Code now shows a warning if the move fails because the target is on a different filesystem (the EXDEV error), or if the entry changed before it could be removed.
Commands running in the sandbox, a restricted environment Claude Code uses to run commands safely, could still be using the worktree. Moving the entry first avoids a timing clash where a running command and the cleanup touch the same files at once.