Skip to content

Instantly share code, notes, and snippets.

@themsaid
Last active May 2, 2018 14:44
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save themsaid/92dc313ffda506f0f0f3f295ed66a64b to your computer and use it in GitHub Desktop.
Delete all branches except
// Delete all except multiple
git branch | grep -v "master\|dev" | xargs git branch -D
// Delete all except 1
git branch | grep -v "master" | xargs git branch -D
@gquemener
Copy link

Yup, but -D should be used carefully though as it'll force delete unmerged branch @themsaid :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment