Last active
February 1, 2019 15:37
-
-
Save garettmd/e427bb3ef3786fb013f0398ad8a9f8d3 to your computer and use it in GitHub Desktop.
Clean up merged git branches in a project directory (use show_clean function first to see what will be removed)
This file contains 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
function clean_merged() { | |
if [[ -z $1 ]] | |
then | |
BRANCH=master | |
else | |
BRANCH="$1" | |
fi | |
git branch --merged "${BRANCH}" | grep -Ev "${BRANCH}|master" | xargs -n 1 git branch -d | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment