Created
July 28, 2021 18:08
-
-
Save chrisjrn/b03e45c206beb015d392a0e20454bbc7 to your computer and use it in GitHub Desktop.
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 git-delete-squashed='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' |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to test, you can replace the final
git branch -Dwith a simple echo