Interesting Git Commands

Get top committers for this year

This is great to identify top performers for annual review.

git shortlog --no-merges --numbered --since "2021-01-01" --summary

Get commit statistics for an author

The number of commits says one thing, but if a person checks in often, you will want to know how big those changes are and compare that way too. This will show the number of files changed, lines added, lines deleted, and lines total.

git log --author "Jack Smith" --no-merges --shortstat --since "2021-01-01" | grep -E "fil(e|es) changed" | awk '{files+=$1; inserted+=$4; deleted+=$6; delta+=$4-$6; ratio=deleted/inserted} END {printf "Commit stats:\n- Files changed (total)..  %s\n- Lines added (total)....  %s\n- Lines deleted (total)..  %s\n- Total lines (delta)....  %s\n- Add./Del. ratio (1:n)..  1 : %s\n", files, inserted, deleted, delta, ratio }' -

Are you looking for a job?