Skip to content

Instantly share code, notes, and snippets.

@toothrot
Last active January 27, 2016 19:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toothrot/78dbb7d3336c62b8cf0b to your computer and use it in GitHub Desktop.
Save toothrot/78dbb7d3336c62b8cf0b to your computer and use it in GitHub Desktop.
Clean up branches that have been merged into master
#!/bin/sh
set -e
if test -d .git
then
git fetch
git checkout master
git branch --merged master | grep -v "\* master" | xargs -n 1 git branch -d
git remote prune origin
git checkout -
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment