Skip to content

Instantly share code, notes, and snippets.

@channainfo
Last active January 29, 2024 02:39
Show Gist options
  • Save channainfo/bb0cb6bbee68dba1ef9710c1aeeaba1d to your computer and use it in GitHub Desktop.
Save channainfo/bb0cb6bbee68dba1ef9710c1aeeaba1d to your computer and use it in GitHub Desktop.
Delete multiple branches from a repo with a pattern
# 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