{"version":"2.1.202","anchor":"worktree-orphan-directory-cleanup","canonical_anchor":"worktree-orphan-directory-cleanup","heading":"Worktree Orphan Directory Cleanup","tier":null,"area":null,"scope":null,"heads_up":null,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.202\/e\/worktree-orphan-directory-cleanup","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.202","markdown":"### Worktree Orphan Directory Cleanup\n\nA new self-healing check detects and removes orphaned worktree directories left behind from interrupted worktree operations.\n\n**Details**\n\n- A directory is considered orphaned when its path exists on disk but is not registered as an active worktree in git\n- Before removing, the check verifies: (1) the branch has no unpushed commits, (2) `git remote` succeeds, (3) `git rev-parse` succeeds on the branch ref\n- If any safety check fails, removal is refused with a message explaining what to do manually\n- On successful cleanup: \"[worktree] removed orphaned worktree directory at [path]\"\n\n**Evidence**\n\nOrphan worktree cleanup (search for `\"Orphaned worktree dir at\"` and `\"refusing to self-heal\"`)"}