Last active
February 7, 2018 15:13
-
-
Save jbutz/42f9dc4ae36707d5844566facd9982b3 to your computer and use it in GitHub Desktop.
Cleanup old 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 | |
git checkout master | |
git pull | |
git fetch --prune | |
BRANCHES=`git branch --merged | grep -v master` | |
IFS=$'\n' | |
for i in $BRANCHES; do | |
git branch -d `echo $i | xargs` | |
done | |
unset IFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment