Clean up a git worktree after a feature is complete - removes the worktree directory and optionally deletes the branch
Safely tear down a git worktree when development on a feature branch is done.
git worktree list to show all active worktreescd into the worktree path (or read its status remotely) and run git status to check for:
git log --oneline @{u}..HEAD or git log --oneline origin/<branch>..HEAD)git branch --merged <base-branch> from the main worktreegh pr list --head <branch> --state merged if gh is availablegit worktree remove <worktree-path>
git worktree remove --force <worktree-path>git worktree prune to clean up stale worktree referencesgit branch -d <branch-name>git push origin --delete <branch-name>git branch -D if the user explicitly requests itgit worktree list to confirm the worktree is gonegit branch to confirm branch stategit worktree prune handles the cleanup