Unclear It is not shown whether the check for a worktree that has moved branch is switched on by default.
A worktree is a second working copy of your git repository in its own folder, on its own branch. When you exit a session that used one, Claude Code now checks whether the worktree has been switched away from its original branch, and counts the commits that exist only on that original branch.
The exit dialog uses this:
- When the worktree has moved, it says which branch it is now on, for example "The worktree is now on ... which is kept either way."
- When commits exist only on the worktree's branch, it warns "Commits only on ... will be lost."
- A worktree is removed automatically as clean only when no commits would be lost.
- Before removing, Claude Code checks again that the session's worktree has not changed. If it has, it prints a message beginning "The exit didn't remove the worktree at".
Before, Claude Code left the worktree alone with a note that the session had switched away from it, and counted commits only from where the session started. The usage data recorded when a worktree is kept or removed now also includes the number of commits only on the worktree's branch.
If you switched branches inside a worktree and then exited, commits could be lost without warning. Now you are told about them, and they are not removed silently.
It is not shown whether the check for a worktree that has moved branch is switched on by default.