Follow Discord
Sweep 22 Sep 2026 · 17:19Z Build v2.1.280 501 read Stable v2.1.267 Latest v2.1.280 Next v2.1.280 Feeds RSS JSON llms.txt Unofficial
Claude Code v2.1.268 ·

Force-remove stuck worktrees, with new safety checks and CLI/fleet-view support

Sessions and worktrees can now be force-removed when git or hooks can't clean them up, with new safety checks and a fleet-view confirmation

TierUse it nowhow much it should matter to you
Useful4my rating, 1 to 5
Signal3worth watching, 1 to 5
AreaSessionswhat it touches
KindNew Featuresin v2.1.268,
Group of 6 Use it now Notable

Sessions and worktrees can now be force-removed when git or hooks can't clean them up, with new safety checks and a fleet-view confirmation

What

  • Job/session deletion logic now supports an explicit force-remove path for a worktree's directory, used when the normal removal (via git or the WorktreeRemove hook) can't clean it up.
  • Before force-removing, Claude Code checks for nested git repositories, tracked (not just uncommitted) changes, and verifies the worktree is actually registered in git's own worktree list; the worktree-state check now separately reports trackedChanges (real edits) versus plain dirty (which includes untracked files).
  • If removal is still withheld, the reason is one of tracked_changes, nested_repositories, nested_unverified, or not_registered, and a new aFt message generator produces detailed explanations for every possible refusal reason (dirty, unpushed, unpushed_shared, in_use, live_lock, occupied, shared_record, records_unreadable, unverified, identity_changed, and the remove_failed sub-reasons above).
  • The claude rm CLI command gains two new flags: --discard-unpushed <commit>@<worktree-id> to discard unpushed/uncommitted changes on a worktree still at a given commit, and --force-remove-worktree <worktree-id> to force-delete a worktree directory.
  • The fleet view's job-delete action gained a second confirm-and-retry path for force-removing a worktree (alongside the existing 'discard unpushed changes' offer), and reports whether the branch was preserved.
  • Deletion telemetry and results now distinguish a forced removal from the existing 'left worktree in place' outcome, via a new worktree_force_removed event and a forcedWorktreeRemoval/forceRemoveWithheld result field.

Why

Worktrees (the separate folders git uses for each session's checkout) can get stuck when git or a cleanup hook can't remove them, blocking session/job deletion. This gives users and the CLI an explicit, safety-checked way to force the removal through instead of leaving orphaned directories behind, while refusing to blow away directories with nested repos or real tracked changes without being told to.

Read from
Names in the bundleclaude rm
Since it was published

The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.

Confirmed since Anthropic's documentation has since written up claude rm, on Error reference. push them and run 'claude rm 7c5dcf5d' again, or discard the worktree and its commits: claude rm 7c5dcf5d --discard-unpushed a1b2c3d000000000000000000000000000000000@0123456789abcdef0123456789abcdef errors see the edit
How sure we are
One source agreesOne thing we can check says the same as this entry.
Anthropic's documentation agreesAnthropic's documentation has since written up claude rm, on Error reference.

See this entry in the whole of v2.1.268 →

Feedback