Created
November 29, 2016 13:38
-
-
Save denisidoro/16c80b4768b2676d42eab64417abc055 to your computer and use it in GitHub Desktop.
Prompt to delete each branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
function prompt { | |
printf "Do you want to delete $1? (y/N)? " | |
read -r answer | |
if echo "$answer" | grep -iq "^y" ;then | |
git branch -D $1 | |
fi | |
} | |
permanent=(master develop) | |
for branch in $(git branch | cut -c 3-) ; do | |
if ! [[ ${permanent[*]} =~ "$branch" ]]; then | |
prompt "$branch" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment