Skip to content

Instantly share code, notes, and snippets.

@igodorogea
Last active July 5, 2018 14:11
Show Gist options
  • Save igodorogea/ce0463152c17a917ef8a0594cb1e9a52 to your computer and use it in GitHub Desktop.
Save igodorogea/ce0463152c17a917ef8a0594cb1e9a52 to your computer and use it in GitHub Desktop.
Remove all your local git branches except ...
  1. Delete all local branches that track remote origin except - master, dev and demo
    git branch -r | grep origin | grep -v origin/HEAD | grep -v "origin/dev$" | grep -v "origin/master$" | grep -v "origin/demo$" | xargs -n 1 git branch -rd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment