I recently needed to check how much I had contributed to a work project. I wanted to know how to count the number of commits and number of lines I had authored. It is a bit vain, I know but I still wanted to know :D. I found two ways to do it on Stack Overflow. Here’s how to to it:
Count the number of lines authored by a user
Please note that I used this command on Linux so it might not work on Windows.
git log --author="_Your_Name_Here_" --pretty=tformat: --numstat \ | gawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n", add, subs, loc }' -
Number of commits per user
git shortlog -s -n --all --no-merges
References: