Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt matt-diehl

  • Google
  • Jersey City
View GitHub Profile
@mdp
mdp / cleanup.sh
Created Sep 30, 2011
Git branch cleanup
View cleanup.sh
# This must be run from master
git checkout master
# Update our list of remotes
git fetch
git remote prune origin
# Remove local fully merged branches
git branch --merged master | grep -v 'master$' | xargs git branch -d
# Show remote fully merged branches
echo "The following remote branches are fully merged and will be removed:"
git branch -r --merged master | sed 's/ *origin\///' | grep -v 'master$'