Created
June 12, 2022 23:37
-
-
Save Masynchin/e86cc524c16a7063f3f98c45d0987b73 to your computer and use it in GitHub Desktop.
Delete all git branches except main
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shamelessly stolen from https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/delete-all-branches-except-master-main-local-remote | |
# using ripgrep instead of grep, so it is two symbols shorter :) | |
git branch | rg -v 'main' | xargs git branch -D |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment