Skip to content

Instantly share code, notes, and snippets.

@e0da
Created February 16, 2015 17:40
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 e0da/b05c9b049d19a31a5e76 to your computer and use it in GitHub Desktop.
Save e0da/b05c9b049d19a31a5e76 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Attempt to delete every branch except master and the currently checked out
# branch. If the branch isn't merged, it won't delete, and it will be noted on
# STDERR.
git branch | grep -v '\bmaster\b\|^\*' | while read branch; do
git branch -d $branch
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment