Skip to content

Instantly share code, notes, and snippets.

@naveed-ahmad
Last active January 22, 2019 16:38
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 naveed-ahmad/43151ca612b90b3007862e4e7f3553ea to your computer and use it in GitHub Desktop.
Save naveed-ahmad/43151ca612b90b3007862e4e7f3553ea to your computer and use it in GitHub Desktop.
cleanup local git branches
# Remove all branches except master and develop
git branch | grep -v "master\|develop" | xargs git branch -D
# Even better, create a git alias
git config --global alias.clean-branches "!git branch | grep -v "master\|develop" | xargs git branch -D"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment