Created
September 30, 2016 23:51
-
-
Save naftulikay/67fcd2e48abb9de00fb7595137438fcc to your computer and use it in GitHub Desktop.
Usage: `git branch-clean`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 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