{"version":"2.1.290","anchor":"worktree-removal-hardened-against-leftover-git-directory-fil","canonical_anchor":"worktree-removal-hardened-against-leftover-git-directory-fil","heading":"Worktree cleanup refuses to delete folders that hold git's own files","tier":"notice","area":"Worktrees","scope":"individual","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.290\/e\/worktree-removal-hardened-against-leftover-git-directory-fil","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.290","markdown":"### Worktree cleanup refuses to delete folders that hold git's own files\n\nClaude Code no longer removes a worktree folder that holds git's internal files or could not be checked, and its error text hides unsafe paths\n\n**What**\n\nA worktree is an extra working folder linked to a git repository. When Claude Code cleans up a worktree, it now refuses to remove a folder that holds git's own internal files (objects, config, packed-refs, hooks or worktrees), or that it could not check for them.\n\nOther changes to cleanup:\n\n- A leftover worktree whose `.git` file points somewhere else is left as it is, with a message saying so.\n\n- Deletes that fail partway are handled by a new removal routine.\n\n- Error messages hide paths that contain control characters (invisible characters that can disturb a terminal).\n\n- Errors from repairing orphaned worktrees are reworded.\n\n**Why**\n\nCleanup is less likely to delete part of a real repository by mistake.\n\n- Area: Worktrees\n- Tier: You'll notice\n- Useful: 2\/5\n- Signal: 1\/5\n- Scope: individual\n- Heads-up: no"}