Created
January 18, 2017 00:26
-
-
Save hoefling/0e63c7e0c598f3c9efdeba7a1c292663 to your computer and use it in GitHub Desktop.
stats in git repo
This file contains hidden or 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
# count commits, sort by author | |
$ git shortlog -s -n | |
# same as above, w/o merge commits | |
$ git shortlog -s -n --no-merges | |
# same as above on all remote branches | |
$ git shortlog -s -n --no-merges --all | |
# counts insertions/deletions/delta locs for all authors in repo | |
# inspired by http://stackoverflow.com/questions/1265040/how-to-count-total-lines-changed-by-a-specific-author-in-a-git-repository | |
_rule="========================================================"; printf "\n %-18s %12s %12s %10s\n" "Name" "Insertions" "Deletions" "Delta"; printf "%56.56s\n" "$_rule"; git log --format='%aN' | sort -u | while read name; do git log --author="$name" --pretty=tformat: --numstat --no-merges | grep -v '.xsl\|\.xml' | awk -v author="$name" '{ ins += $1; dels += $2; delta += $1 - $2 } END { printf "%-18s %13s %12s %10s\n", author, ins, dels, delta }' -; done; printf "%56.56s\n" "$_rule" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment