Skip to content

Instantly share code, notes, and snippets.

@denisidoro

denisidoro/gbdp.sh

Created Nov 29, 2016
Embed
What would you like to do?
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
You can’t perform that action at this time.