Created
March 30, 2018 22:53
-
-
Save anaisbetts/79c142a28fb020b4b80f0ecb62831ab9 to your computer and use it in GitHub Desktop.
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 | |
git branch --merged | while read line | |
do | |
# If the line is in the format '* master' (indicating the current branch), | |
# this will be effectively empty, so we don't somehow delete the current | |
# branch | |
BRANCH=`echo "$line" | awk -F '*' '{ print $1 }'` | |
if [ -z "$BRANCH" ] | |
then | |
continue | |
fi | |
if [ "$BRANCH" == "master" ] | |
then | |
continue | |
fi | |
git branch -d "$BRANCH" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment