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
Dry run:
git branch -r --list 'origin/your-branch-name/*' | sed "s/origin\///" | xargs -I {} echo {}
Delete remote branches:
git branch -r --list 'origin/your-branch-name/*' | sed "s/origin\///" | xargs -I {} git push origin --delete {}
Delete only fully merged remote branches:
git branch -r --merged --list 'origin/your-branch-name/*' | sed "s/origin\///" | xargs -I {} git push origin --delete {}
Explanation:
sed "s/origin\///"
will remove origin/
from the branch name. Without stripping that away I got: remote ref does not exist