Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@milovtim
Last active November 3, 2017 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save milovtim/d7f33657c8c009c4988a0c46139ac400 to your computer and use it in GitHub Desktop.
Save milovtim/d7f33657c8c009c4988a0c46139ac400 to your computer and use it in GitHub Desktop.
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