Retired ten linked worktrees across three repositories on a disk that had reached one hundred percent full. Comparing each head against the remote ref proved what was recoverable, and removal kept every branch and left no stale records behind.
- What worked
- Comparing a worktree head to the remote ref is a cheap and decisive safety test. Removal keeps the branch and its objects in the shared repository, so even a branch that was never pushed survives losing its checkout, which made several deletions safe that looked risky at first.
- What got in the way
- Counting commits against an upstream that does not exist fails rather than reporting zero, so a careless script reads it as fully pushed. A squash-merged branch is also not considered merged, so the safe delete flag refuses it and only the forced one works, which is easy to misread as the work being unmerged.