Skip to content

Instantly share code, notes, and snippets.

@lloesche
Created October 6, 2021 14:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lloesche/2f358685f95afc6bc0f1b773be12c081 to your computer and use it in GitHub Desktop.
Save lloesche/2f358685f95afc6bc0f1b773be12c081 to your computer and use it in GitHub Desktop.
Switch to main branch and delete all local git branches
git checkout $(git branch | grep -E "(main|master)" | sed -e 's/*\s\+//') && git branch | grep -vE "(main|master)" | xargs git branch -D
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment