Skip to content

Instantly share code, notes, and snippets.

@IzStriker
Last active October 25, 2022 15:32
Show Gist options
  • Save IzStriker/1d6b725377a8e5fe74527e5b2d75c443 to your computer and use it in GitHub Desktop.
Save IzStriker/1d6b725377a8e5fe74527e5b2d75c443 to your computer and use it in GitHub Desktop.

Clean up old branches

Modify array with branches you want to keep

git branch | %{ $_.Trim() } | ?{ @('main','master') -notcontains $_} | %{ git branch -D $_ }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment