I have a team member who inadvertently pushed over 150 of his local branches to our central repo. Thankfully, they all have the same prefix. Using that prefix, is there a gi
Neevek's solution is elegant, but it can be better: the solution as proposed calls 'git push' once per branch, which means an additional network round-trip per branch to be deleted. Since you're using awk anyway, why not use it to prefix the ':' and then xargs can call 'git push' exactly once and delete all the branches at once:
Dry-run to list the branches that would be deleted:
git branch -r | awk -F/ '/\/PREFIX/{print ":" $2}'
Final solution to actually push the deletes:
git branch -r | awk -F/ '/\/PREFIX/{print ":" $2}' | xargs git push origin