# First use prune --dry-run to filter+delete the local branches
git remote prune origin --dry-run \
| grep origin/ \
| sed 's,.*origin/,,g' \
| xargs git branch -D
# Second delete the remote refs without --dry-run
git remote prune origin
Prune the same branches from local- and remote-refs(in my example from origin
).