Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Usage: `git branch-clean`
# Usage: git branch-clean
# Removes all branches which have been successfully merged safely.
# Uses -d instead of -D to ensure only merged branches will be
# deleted.
# Install this script on your PATH somewhere.
set -ex
git branch --merged | egrep -v "(^\*|master|dev|production)" | \
xargs -r git branch -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.