Skip to content

Instantly share code, notes, and snippets.

@zspencer
Last active April 6, 2016 00:17
Show Gist options
  • Save zspencer/4c3707e783a476389639 to your computer and use it in GitHub Desktop.
Save zspencer/4c3707e783a476389639 to your computer and use it in GitHub Desktop.
git remove-extraneous-branches
[alias]
# Prints merged branches without the current working branch and mainline branches
extraneous-branches = "!f() { git branch --merged | grep -v -e 'gh-pages' -e 'master' -e 'staging' -e 'production'; }; echo `f`"
# Deletes the extraneous branches with a soft -d
remove-extraneous-branches = "!f() { git extraneous-branches; }; git branch -d `f`"
reb = remove-extraneous-branches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment