Clean up after deleting a worktree folder manually
maintenance & cleanup
// what it does
If a worktree directory was deleted with rm -rf (or lives on a drive that's gone), the repository still carries its metadata in .git/worktrees — and Git still considers its branch checked out. prune drops the stale entries; --dry-run -v previews what would go.
// shell
$ git worktree prune --dry-run -v$ git worktree prune// gotcha
This is the fix for the classic "fatal: 'X' is already checked out at ..." pointing at a directory that no longer exists. Git auto-prunes eventually (gc.worktreePruneExpire, default 3 months), but there's no reason to wait.