Skip to content

Instantly share code, notes, and snippets.

@drexler
Forked from leoapost/gist:4318441
Last active February 8, 2018 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drexler/463676e7c36de6ddb01ea798eb308df8 to your computer and use it in GitHub Desktop.
Save drexler/463676e7c36de6ddb01ea798eb308df8 to your computer and use it in GitHub Desktop.
Delete all remote branches, except master
# Replace REMOTE_NAME with your remote name (e.g. origin)
git branch -r | grep REMOTE_NAME/ | grep -v 'master$' | grep -v HEAD| cut -d/ -f2 | while read line; do git push REMOTE_NAME :$line; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment