Skip to content

Instantly share code, notes, and snippets.

@KacperPucek
Created July 22, 2016 09:55
Show Gist options
  • Save KacperPucek/80e3b65b554133a46808cde176d4d576 to your computer and use it in GitHub Desktop.
Save KacperPucek/80e3b65b554133a46808cde176d4d576 to your computer and use it in GitHub Desktop.
$ git branch | grep -v "master" | xargs git branch -D
@kubakrzempek
Copy link

Oftentimes you want to remove only merged branches in a more-safe way, i.e. omitting -D flag and replacing it with -d.
What I find working best is
git branch --merged | grep -v '\*' | grep -v 'master' | xargs -n 1 git branch -d

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