Skip to content

Instantly share code, notes, and snippets.

@clamstew
Created February 28, 2017 20:05
Show Gist options
  • Save clamstew/f63f525a4f1b40c515ceffcb251c93b0 to your computer and use it in GitHub Desktop.
Save clamstew/f63f525a4f1b40c515ceffcb251c93b0 to your computer and use it in GitHub Desktop.
deletes all merged branches on git repo
git branch --remote --merged |
grep origin |
grep -v '>' |
grep -v master |
grep -v develop |
# grep -v <any-other-branch-name-you-want-to-keep> |
xargs -L1 |
cut -d"/" -f2- |
xargs git push origin --delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment