Skip to content

Instantly share code, notes, and snippets.

@leongaban
Created February 6, 2018 15:50
Show Gist options
  • Save leongaban/8e0114037b4ece75358e4041cb5bd45a to your computer and use it in GitHub Desktop.
Save leongaban/8e0114037b4ece75358e4041cb5bd45a to your computer and use it in GitHub Desktop.
Prune local Git branches
# Replace REL_BRANCH with the appropriate name
git fetch --all --prune && git branch --merged | egrep -v "(^\*|REL_BRANCH|master)" | xargs -I % sh -c 'git branch -d %1; git push origin :%1;'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment