#TIL 43 - Delete all remote branches except main
Remove all remote branches except for the one named "main"
git branch -r | grep -v 'main' | sed 's/origin\///' | xargs -I {} git push origin --delete {}
It may be necessary to execute git remote prune origin
first in order to eliminate outdated remote branches.