Created
September 11, 2014 12:57
-
-
Save stefano-garzarella/1cd9b2011c27bbdf5241 to your computer and use it in GitHub Desktop.
[GIT] Remove all remote branches except master
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 | |
#Remove all remote branches except master | |
REMOTE_NAME="github" | |
MASTER_BRANCH="master" | |
git branch -r | grep ${REMOTE_NAME}/ | grep -v ${MASTER_BRANCH} | grep -v HEAD | cut -d/ -f2-10 | while read line; do git push ${REMOTE_NAME} ${MASTER_BRANCH} :$line; done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment