pub fn remove_worktree(path: &Path, force: bool) -> Result<(), WorktreeError>Expand description
Remove the git worktree at path via git worktree remove. Run
from the worktree’s PARENT (which lives inside the main worktree
for claude’s <repo>/.claude/worktrees/<label> layout), since git
refuses to remove the worktree it is invoked from. force adds
--force, removing even a dirty worktree (the despawn path only
reaches this on a verified-clean worktree, or when the caller
explicitly passed force).
Without --force, git itself refuses a worktree with
uncommitted/untracked changes, and also one holding initialized
submodules however clean it is - git-worktree(1) puts both cases
under --force. The unpushed-commits guard lives in
worktree_dirty_reason (git’s own check does not cover unpushed).