Last active
January 29, 2020 00:18
-
-
Save robinsmidsrod/c4e541f728feeaa8a31795eeef9241e3 to your computer and use it in GitHub Desktop.
Output all non-merged refs in a git repo, ordered by number of changed lines in the diff output
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
#!/bin/bash | |
# | |
# Output all non-merged refs in a git repo, ordered by number of changed lines in the diff output | |
# | |
git for-each-ref --shell --format="ref=%(refname)" --no-merged | \ | |
while read entry | |
do | |
eval "$entry" | |
size=$(git diff -U0 "master...$ref" | grep -vP '^(diff|index|@@|\-\-\-|\+\+\+)' | wc -l) | |
echo "$size:$ref" | |
done |\ | |
sort -nr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment