Skip to content

Instantly share code, notes, and snippets.

@jportella93
Created December 11, 2018 10:04
Show Gist options
  • Save jportella93/cfa11fa92e9c5a36d9eb15ff46783afd to your computer and use it in GitHub Desktop.
Save jportella93/cfa11fa92e9c5a36d9eb15ff46783afd to your computer and use it in GitHub Desktop.
Remove all your local git branches but keep master
# Test it first:
# Change master by the name of the branch you want to keep, the branches showing will be eliminated
git branch | grep -v "master"
# Eliminate branches with xargs
git branch | grep -v "master" | xargs git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment