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 ·

Forced (destructive) removal of agent worktrees

Agent worktrees can now be force-removed, deleting all their files after verifying they're linked worktrees, not standalone repos

TierUnder the hoodhow much it should matter to you
Useful2my rating, 1 to 5
Signal2worth watching, 1 to 5
AreaAgent Worktreeswhat it touches
KindInternal Changesin v2.1.268,
Under the hood

Agent worktrees can now be force-removed, deleting all their files after verifying they're linked worktrees, not standalone repos

What

Cleaning up a git worktree used for an agent (a separate working copy of a repository, stored under .claude/worktrees) now supports a forced, destructive removal path. It deletes all files in the worktree directory except a verified .git file, then removes the directory itself. Before doing this, it checks that the target is actually a linked worktree, meaning it has a .git file pointing elsewhere rather than being a standalone repository with its own full history. If the deletion only partially succeeds, the .git gitlink pointer is restored.

Why

This lets Claude Code fully clean up an agent's worktree when needed, while the standalone-repo check guards against accidentally deleting the only copy of a repository's history, and the pointer restoration protects against leaving things in a broken half-deleted state if something goes wrong partway through.

See this entry in the whole of v2.1.268 →

Feedback