Last active
December 17, 2018 15:08
-
-
Save mattbostock/31b56bf9dc6e7f51e449a4d72af05f1e to your computer and use it in GitHub Desktop.
Prune Git branches that were merged by rebasing in GitHub
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
#!/usr/bin/env bash | |
set -eo pipefail | |
# Not thoroughly tested, please use with caution! Try with 'echo {}' first to confirm it works for you. | |
# | |
# exec git for-each-ref refs/heads/ "--format=%(refname:short)" | grep -v master | xargs -P 4 -I {} bash -c "( ! git cherry master {} | grep -q '^[^-]' ) && git branch -D {}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment