Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alexisdiel/32041c70968245ffaff26f0e77a98a79 to your computer and use it in GitHub Desktop.
Save alexisdiel/32041c70968245ffaff26f0e77a98a79 to your computer and use it in GitHub Desktop.
Git delete all merged branches
LOCAL BRANCHES (git rmlocal)
git config --global alias.rmlocal 'git branch --merged | egrep -v "(^\*|master|prod)" | xargs git branch -d'
REMOTE BRANCHES (git rmremote)
git config --global alias.rmremote 'git branch -r --merged | egrep -v "(^\*|master|prod)" | sed "s/origin\///" | xargs -n 1 git branch -d origin'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment