How to fix stale git branch -r (delete phantom git branches)?

When git remote branch is deleted, but still appears in ‘branch -a’, you should:


git remote show origin

git branch -d branch-name
git remote prune origin

git gc --prune=now