diff options
Diffstat (limited to 'git-author-stats')
-rwxr-xr-x | git-author-stats | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/git-author-stats b/git-author-stats new file mode 100755 index 0000000..8bd2d9b --- /dev/null +++ b/git-author-stats @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +script=$(cat << 'EOF' +NF == 1 { name = $1; commits[name] += 1 } +NF == 3 { plus[name] += $1; minus[name] += $2 } +END { + for (name in plus) { + print name "\t+" plus[name] "\t-" minus[name] "\t" commits[name] + } +} +EOF +) + +(printf $'name\tadded\tremoved\tcommits\n'; + +git log --numstat --pretty=$'%aN' "$@" \ + | awk -F$'\t' "$script" \ + | sort --field-separator=$'\t' -k${ASTATS_SORT_COLUMN:-2} -gr +) > /tmp/git-author-stats + +column -t -s $'\t' /tmp/git-author-stats +rm /tmp/git-author-stats |