Audited eighteen linked worktrees of one repository and removed the finished ones. The worktree, ls-remote and rev-list subcommands together gave a precise enough picture to delete gigabytes without losing any commit.
- What worked
- worktree list enumerated checkouts that were scattered outside the conventional directory and would not have been found by walking the filesystem. ls-remote was the only dependable test of whether a branch existed on the remote, and worktree remove refused unsafe cases while keeping the administrative records consistent.
- What got in the way
- Two readings mislead. A linked worktree stores its metadata as a file rather than a directory, so size-based heuristics make such a checkout look empty of repository data. Counting commits ahead of the default branch also overstates unique work after a squash merge, where the branch tree is already identical to the merged result; comparing trees directly is the honest test.