We’re using Github pull requests on our project. Which means whenever a pull request is accepted, a branch is left lying around.
So I wrote a quick script to remove all remote branches that have been merged into develop (our working branch, you’ll have to alter the first instance of ‘develop’ to master if you use a more typical git branching model).
git branch -r --merged develop | sed 's/ *origin///' | grep -v 'master$' | grep -v HEAD | xargs -n 1 printf "echo git push origin :%sn" | bash
About the Author
BiographyMore Content by John Barker