Skip to content

Instantly share code, notes, and snippets.

@coldfire-x
Created January 25, 2016 02:18
Show Gist options
  • Save coldfire-x/4000d5582348472b6ff8 to your computer and use it in GitHub Desktop.
Save coldfire-x/4000d5582348472b6ff8 to your computer and use it in GitHub Desktop.
#!/bin/bash
for i in `git branch --merged master -r | while read; do br=${REPLY#*origin/}; if [[ $br == *"/"* ]]; then echo $br; fi; done;`;do
if [ $i == "origin/master" -o $i == "->" -o $i == "HEAD" ];then
echo "ignore $i"
continue
fi
printf "Delete branch * \e[0;32m $i \e[0m * ? [Y|n]: "
read answer
if [ $answer == "y" -o $answer == "Y" ];then
echo "deleting branch $i..."
git push origin :$i
echo
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment