Skip to content

Instantly share code, notes, and snippets.

@vsizov
Forked from sleistner/git-pristine.sh
Last active December 25, 2015 12:14
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 vsizov/4ff7c0b7c67be2cba0b1 to your computer and use it in GitHub Desktop.
Save vsizov/4ff7c0b7c67be2cba0b1 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