Last active
March 16, 2016 06:15
-
-
Save dennisroche/9a53213c2bafe6a16dbc to your computer and use it in GitHub Desktop.
Git, Prune Remote Branches that have been merged into origin/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
# Needs to executed in git bash, powershell with posh-git won't work. | |
# NB, change grep -v master to be the branch you want to check, e.g. grep -v development | |
# Preview | |
git fetch -p origin && git branch -r --merged | grep origin | grep -v '>' | grep -v master | xargs -L1 | cut -d"/" -f2- | xargs -d ' ' | |
# Actual | |
git fetch -p origin && git branch -r --merged | grep origin | grep -v '>' | grep -v master | xargs -L1 | cut -d"/" -f2- | xargs git push origin --delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment