Last Updated: January 27, 2020
·
1.018K
· adkron

Delete all remote merged branches

This works relative to the branch you are on.

git branch -r --merged | grep -v <branch you don't want removed ie dev or master> | sed 's/origin\//:/' | xargs git push <remote name>

You can do grep -v multiple times to remove unwanted branch deletions.