Last active
February 4, 2019 18:16
-
-
Save TheBox193/3b0f3d87f72a598665c5623ae90952ec to your computer and use it in GitHub Desktop.
Selectively bulk remove git branches
This file contains 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/bash | |
if [ ! -d ".git" ]; then | |
echo "Not a git Directory" | |
exit 1 | |
fi | |
git branch -d `git for-each-ref --format="%(refname:short)" refs/heads/\* | | |
while read -r line; do | |
read -p "remove branch: $line (y/N)?" answer </dev/tty; | |
case "$answer" in y|Y) echo "$line";; | |
esac; | |
done` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment