Skip to content

Instantly share code, notes, and snippets.

@jesselang
Created October 23, 2015 20:55
Show Gist options
  • Save jesselang/c1c47606055ed5d83582 to your computer and use it in GitHub Desktop.
Save jesselang/c1c47606055ed5d83582 to your computer and use it in GitHub Desktop.
One-liner to keep your origin remote tidy (assuming you only care about branches being merged to master)
git fetch --prune && git branch -r --merged origin/HEAD | sed "s/origin\///" | grep -v 'master\|HEAD' | xargs -n 1 git push --delete origin && git fetch --prune
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment