Skip to content

Instantly share code, notes, and snippets.

@aga5tya
Forked from leoapost/gist:4318441
Created April 23, 2018 15:35
Show Gist options
  • Save aga5tya/b7ca66acfb1b4fd3290bacd95495bf74 to your computer and use it in GitHub Desktop.
Save aga5tya/b7ca66acfb1b4fd3290bacd95495bf74 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