Skip to content

Instantly share code, notes, and snippets.

@djmccormick
Last active August 29, 2015 14:06
Show Gist options
  • Save djmccormick/4ec1d73392d2fd72df47 to your computer and use it in GitHub Desktop.
Save djmccormick/4ec1d73392d2fd72df47 to your computer and use it in GitHub Desktop.
A quick shell script to clean up merged branches both locally and on origin, plus prune local branches
#!/bin/sh
git checkout master
git remote update --prune
git branch -r --merged | grep -v master | grep -v develop | sed -e 's/origin\//:/' | xargs git push origin
git branch --merged | grep -v master | grep -v develop | xargs git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment