Skip to content

Instantly share code, notes, and snippets.

@leemour
Last active July 12, 2018 11:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leemour/1102998b6af0070ce78695ca1b4c483d to your computer and use it in GitHub Desktop.
Save leemour/1102998b6af0070ce78695ca1b4c483d to your computer and use it in GitHub Desktop.
Mass delete multiple remote branches in git repository (and locally)
# Remote
git br -r | grep -v 'master\|dev\|new_front' | awk -Forigin/ '{print $2 $3}' | xargs -I {} git push origin :{}
# Local
git branch | grep -v 'master\|dev\|new_front' | xargs -I {} git branch -D {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment