Created
January 22, 2015 01:23
-
-
Save candeira/a87cf0b5a71b20543662 to your computer and use it in GitHub Desktop.
git deadbranches command deletes all local and remote branches merged into develop
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
#!/usr/bin/env bash | |
git checkout develop || (echo "Aborting..." && exit 1) | |
git pull || (echo "Aborting..." && exit 1) | |
BRANCHES=$(git branch --merged | grep -v develop | grep -v master | tr -d "\n") | |
for BRANCH in $BRANCHES | |
do | |
git branch -d $BRANCH && git push --delete origin $BRANCH | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment