Created
April 27, 2018 20:19
-
-
Save bjhomer/89aa20fa6aafb858ee40f1f0f0613ad8 to your computer and use it in GitHub Desktop.
git delete-merged
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
[alias] | |
delete-merged = !bash -c '\ | |
REMOTE=$1 && \ | |
REMOTE=${REMOTE:="origin"} && \ | |
echo "Fetching $REMOTE" && \ | |
git fetch $REMOTE --prune && \ | |
git branch -vv | grep "gone]" | awk \"{ print \\$1 }\" | xargs git branch -d' - | |
# usage: `git delete-merged` | |
# Deletes all local branches that are tracking a remote branch which no longer exists. | |
# If the local branch has unmerged changes, it prints a warning for that branch instead. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment