Skip to content

Instantly share code, notes, and snippets.

@sleistner
Created August 7, 2012 10:26
Show Gist options
  • Save sleistner/3284360 to your computer and use it in GitHub Desktop.
Save sleistner/3284360 to your computer and use it in GitHub Desktop.
Remove all remote and local branches except master and next
#!/bin/bash
git branch -d -r `git branch -r | awk '{ if ($0 !~ /next|master/) printf "%s", $0 }'`
git branch -D `git branch | awk '{ if ($0 !~ /next|master/) printf "%s", $0 }'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment