Created
December 17, 2014 11:02
-
-
Save andrewwheal/c881c026df934ca0cc9e to your computer and use it in GitHub Desktop.
git tidy-branches
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/bash | |
KEEP=$@ | |
branches=$(git branch | grep -v "*" | grep -v "detached" | grep -v "no branch") | |
if [ "$KEEP" != "" ]; then | |
for notthis in $KEEP; do | |
branches=$(echo "$branches" | grep -vE "$notthis") | |
done | |
fi | |
for branch in $branches; do | |
git branch -D $branch | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment