Last active
May 2, 2017 11:15
-
-
Save shospodarets/2f541c6687f319f41763ac7c7db70c12 to your computer and use it in GitHub Desktop.
Remove Git branches, which are merged to the current one (+ ability to exclude some of them)
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
#!/usr/bin/env bash | |
# based on https://gist.github.com/schacon/942899 | |
# list | |
git branch -r --merged | grep origin | grep -v '>' | grep -v master\* | grep -v release-\* | xargs -L1 | |
# delete | |
git branch -r --merged | grep origin | grep -v '>' | grep -v master\* | grep -v release-\* | xargs -L1 | awk '{sub(/origin\//,"");print}' | xargs git push origin --delete |
Author
shospodarets
commented
Apr 24, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment