Developer Life
Count commits, file changes, lines added or deleted, and Pull Request for the year
Get some statistic through using Git Command
2 min readDec 14, 2020
It almost the end of 2020, ever wonder how lines of code added or deleted in your git repo? How many files have changed, etc. statistic?
I have to search around for the right git command to get this info, as it is not readily available on the GitHub page. Hence sharing with all in case it is handy.
Counting the number or Commits for a Branch
git rev-list --count --since="Jan 1 2020" master
You can also use --before
.
Count the file changes and lines added or deleted
git log --shortstat --since "Jan 1, 2020" --until "today" | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}'