Skip to content

Instantly share code, notes, and snippets.

@sim2kid
Created May 20, 2024 17:48
Show Gist options
  • Save sim2kid/afc0c987ff7fc29603f1adcd777ce1a3 to your computer and use it in GitHub Desktop.
Save sim2kid/afc0c987ff7fc29603f1adcd777ce1a3 to your computer and use it in GitHub Desktop.
Deletes all local branches for a given git repo. This must be executed in the repo's root folder to work. Very useful for cleaning your local branches.
git branch | %{ $_.Trim() } | ?{ $_ -ne 'master' } | ?{ $_ -ne 'main'} | ?{ $_ -ne 'develop'} | %{ git branch -D $_ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment