Created
March 7, 2020 08:05
-
-
Save federicomichela/905291b4b09b152fb0e4dc36ff8b14d6 to your computer and use it in GitHub Desktop.
Remove branches locally and remotely
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
# [ONLY LOCALLY] | |
git branch | grep "commonPrefix" | xargs git branch -d | |
# [ONLY REMOTELY] | |
git branch --remote | grep -v 'excludeBranch1' | grep -v 'excludeBranch2' | cut -b 10- | xargs git push --delete origin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment