Skip to content

Instantly share code, notes, and snippets.

@avtarnanrey
Created March 2, 2020 17:28
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 avtarnanrey/fbe708f2e733152c30b1eebb363488dd to your computer and use it in GitHub Desktop.
Save avtarnanrey/fbe708f2e733152c30b1eebb363488dd to your computer and use it in GitHub Desktop.
Clean local branches merged or obsolete
// To delete all merged branches except master and dev
git branch --merged | grep -v '\*\|master\|dev' | xargs -n 1 git branch -d
// To delete all branches except master and dev:
git branch | grep -v '\*\|master\|dev' | xargs -n 1 git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment