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] | |
| sweep-branch = "!git for-each-ref refs/heads/ --format=\"%(refname:short)\" | while read branch; do [ \"$branch\" = main ] || [ \"$branch\" = master ] && continue; git rev-parse --abbrev-ref HEAD | grep -qx \"$branch\" && continue; mergeBase=$(git merge-base main \"$branch\" 2>/dev/null) || continue; treeCommit=$(git commit-tree \"$(git rev-parse \"$branch^{tree}\")\" -p \"$mergeBase\" -m _); cherry=$(git cherry main \"$treeCommit\" 2>/dev/null); case \"$cherry\" in \"-\"*) git branch -D \"$branch\" ;; esac; done" |