Skip to content

Instantly share code, notes, and snippets.

@Moriarty16
Forked from leoapost/gist:4318441
Created September 7, 2018 07:57
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 Moriarty16/da531997e0a1c22ab832db78800f0a4b to your computer and use it in GitHub Desktop.
Save Moriarty16/da531997e0a1c22ab832db78800f0a4b 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