Last active
June 23, 2017 22:44
-
-
Save filipelinhares/0dc41ace55a0589e9b66922ba5041274 to your computer and use it in GitHub Desktop.
git delete-squashed-branches
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
# Put in your ~/.somethingrc file | |
# source: https://github.com/not-an-aardvark/git-delete-squashed | |
git-delete-squashed-branches () { | |
git checkout -q master && git for-each-ref refs/heads/ "--format=%(refname:short)" | while read branch; do mergeBase=$(git merge-base master $branch) && [[ $(git cherry master $(git commit-tree $(git rev-parse $branch^{tree}) -p $mergeBase -m _)) == "-"* ]] && git branch -D $branch; done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment