Created
June 6, 2018 12:01
-
-
Save onmotion/512ab8a898fc714270609ade8c9266b3 to your computer and use it in GitHub Desktop.
git remove all 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 | |
# local | |
git branch | grep -v "master" | xargs git branch -D | |
# remote | |
git branch -a --merged remotes/origin/master | grep -v master | grep "remotes/origin/" | cut -d "/" -f 3- | xargs -n 1 git push --delete origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment