Last active
January 29, 2024 02:39
-
-
Save channainfo/bb0cb6bbee68dba1ef9710c1aeeaba1d to your computer and use it in GitHub Desktop.
Delete multiple branches from a repo with a pattern
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 branch -r list all branch from the remote repo | |
# pipe the output to grep only branches start with 'automatic_translations' | |
# echo each branch_name stripping the prefix origin/ | |
# git push origin :{each_branch_name} | |
git branch -r | fgrep origin/automatic_translations | while read x; do echo "deleting ${x/origin\//}"; git push origin ":${x/origin\//}"; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment