Follow Discord
Sweep 22 Oct 2026 · 21:04Z Build v2.1.309 528 read Stable v2.1.308 Latest v2.1.309 Next v2.1.309 Feeds RSS JSON llms.txt llms-full.txt Unofficial

Claude Code v2.1.301 ·

Exiting a worktree now warns about commits that would be lost after a branch switch

On exit, Claude Code checks whether a worktree moved to another branch and only removes it on its own when no commits would be lost

You'll notice Improvements
JSON All of v2.1.301
You'll noticeTier: how much it should matter to you
3Useful: my rating, 1 to 5
2Signal: worth watching, 1 to 5
WorktreesArea: what it touches
ImprovementsKind: in v2.1.301,
ImprovementsSection of the release

Unclear It is not shown whether the check for a worktree that has moved branch is switched on by default.

What

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.

Why

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.

How sure we are
Something disagreesSomething we can check disagrees with this entry, or the writer said they could not settle it.
The writer flagged doubtIt is not shown whether the check for a worktree that has moved branch is switched on by default.

See this entry in the whole of v2.1.301 →

Feedback