Last active
August 29, 2015 14:10
-
-
Save AndreiRailean/da438b77f6633ee3a003 to your computer and use it in GitHub Desktop.
Clear old branches from local and remote repos
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
# Delete all merged local branches except for master | |
git branch --merged master | grep -v master | xargs git branch -d |
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
#Delete all remote branches on origin except master | |
git branch -r | grep origin/ | grep -v master | awk -F'origin/' '{ print $2 }' | xargs -I {} git push origin :{} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ref: