Last active
August 1, 2023 13:47
-
-
Save bozdoz/25ebb60c2e7bfa14f2cba3a593b67ec1 to your computer and use it in GitHub Desktop.
find remote branches that have diverged by some amount of commits
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
git ls-remote --heads origin | while read sha ref; do | |
behind=`git rev-list $sha..master --count` | |
if [ $behind -ge 1000 ]; then | |
echo "$ref $behind"; | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To delete the branches, strip the "refs/heads/" and call
git push origin --delete
: