Prompt to delete each branch
#!/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