Removing and Pruning Worktrees

Remove a worktree with git worktree remove, which refuses if it has uncommitted changes (--force overrides). Deleting the directory by hand leaves Git 1,932 's record of it behind, which prune cleans up:

A worktree deleted by hand, pruned, and a clean removalShell
git worktree add -q --detach ../booknest-old v1.0.0
rm -rf ../booknest-old
git worktree list
git worktree prune -v
git worktree remove ../booknest-1.1
git worktree list
Output
/home/dev/v5-ch2/booknest     a62d631 [main]
/home/dev/v5-ch2/booknest-1.1 264b373 [release/1.1]
/home/dev/v5-ch2/booknest-old 8211cbb (detached HEAD) prunable
Removing worktrees/booknest-old: gitdir file points to non-existent location
/home/dev/v5-ch2/booknest a62d631 [main]

git worktree list marks a worktree whose directory is gone as prunable (Git 2.31), and git gc prunes such records automatically after gc.worktreePruneExpire (three months). Removing a worktree keeps its branch: release/1.1 still exists, locally and on the server, for the next patch. A worktree on a removable drive can be protected from pruning with git worktree lock, and git worktree move relocates one safely.