Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
List remote git branches. Grep the list by some regexp. get the branch name from result (without 'origin/' prefix). Ask git to delete remote branch by name
git branch --list -r |
grep -P "SOME_REGEXP" |
while read line;
do
IFS="/" read -r -a arr <<< "$line";
git push origin --delete "${arr[1]}";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment