Skip to content

Instantly share code, notes, and snippets.

@nirev
Forked from malclocke/gist:943565
Last active August 29, 2015 14:02
Show Gist options
  • Save nirev/f367258726baffef6ca5 to your computer and use it in GitHub Desktop.
Save nirev/f367258726baffef6ca5 to your computer and use it in GitHub Desktop.
Delete git remote branches that are merged
# deletes remote branchs that are merged
$ git branch -r --merged |
awk -F'/' '/^ *origin/{if(!match($0, /(>|master|production)/)){print $2}}' |
xargs git push origin --delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment