Last active
April 8, 2023 01:52
-
-
Save aks/d1ac5e4f78f08796e90248afd847cef6 to your computer and use it in GitHub Desktop.
Bash script to show the top-committers in a repo, in descending frequency 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
#!/usr/bin/env bash | |
# top-committers [NUMBER] | |
count=${1:-200} | |
git log --pretty=format:"%ae %at" | | |
awk 'BEGIN { FS=" "; OFS="," } | |
!seen[$1]++ { first[$1]=$2 } | |
{ last[$1]=$2; count[$1]++ } | |
END { | |
for (email in first) print email, first[email], last[email], count[email] | |
}' | | |
while IFS=, read -r email first last count; do | |
printf "%s | %s | %s | %s\n" "$email" "$(date -u -r $first '+%Y-%m-%d')" "$(date -u -r $last '+%Y-%m-%d')" "$count"; | |
done 2>/dev/null | | |
sort -bnr -k 7 | | |
head -$count | | |
column -t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment