Skip to content

Instantly share code, notes, and snippets.

@bcomnes
Created April 30, 2016 01:15
Show Gist options
  • Save bcomnes/3f9686f6d9caf7b75d2643377c36de89 to your computer and use it in GitHub Desktop.
Save bcomnes/3f9686f6d9caf7b75d2643377c36de89 to your computer and use it in GitHub Desktop.
Delete merged branches on git
#!/usr/bin/env bash
git branch -r --merged |
grep origin |
grep -v '>' |
grep -v 'master' |
xargs -L1 |
awk '{sub(/origin\//,"");print}' |
xargs git push origin --delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment