Skip to content

Instantly share code, notes, and snippets.

@thinkyhead
Last active March 24, 2016 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thinkyhead/ff72e9cef8c908f2a972 to your computer and use it in GitHub Desktop.
Save thinkyhead/ff72e9cef8c908f2a972 to your computer and use it in GitHub Desktop.
Git Prune Everything - Prune all merged branches and all "gone" branches
#!/usr/bin/env bash
echo "Pruning Merged Branches..."
git branch --merged | egrep -v "^\*|master|development" | xargs -n 1 git branch -d
echo
echo "Pruning Gone Branches..."
git branch -vv | grep ': gone]' | gawk '{print $1}' | xargs -n 1 git branch -D
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment