Hi.
Last active
March 18, 2020 20:12
-
-
Save kirbysayshi/4b4576d23b271d93e71c33544acb5a73 to your computer and use it in GitHub Desktop.
all the other ones on the internet either don't work, or only delete local tracking branches. If you have squash+merge enabled for a repo, those techniques won't work!
This file contains hidden or 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
git fetch -p; | |
git branch | grep -v master | while read line; do | |
if git branch -r | grep -q -F $line; | |
then | |
echo not deleting $line; | |
else echo git branch -d $line; | |
fi; | |
done; |
This file contains hidden or 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
git fetch -p; git branch | grep -v master | while read line; do if git branch -r | grep -q -F $line; then echo not deleting $line; else echo git branch -d $line; fi; done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment