Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove Git branches, which are merged to the current one (+ ability to exclude some of them)
#!/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
@malyw

This comment has been minimized.

Copy link
Owner Author

commented Apr 24, 2017

alt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.