Skip to content

Instantly share code, notes, and snippets.

@nyarly
Created February 8, 2013 20:43
Show Gist options
  • Save nyarly/4741783 to your computer and use it in GitHub Desktop.
Save nyarly/4741783 to your computer and use it in GitHub Desktop.
#!/bin/bash
for branch in $(git branch --merged | egrep -v '(master)|(staging)|(production)'); do
echo Cleaning: $branch
#If we can delete the branch remotely, delete it locally
git push origin :$branch && git branch -d $branch
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment