Graeme's Wiki

git and repository statistics
If you ever wanted to pull some statistics from your git repository, here are some examples. The examples below, generate statistics based on the last 6 months. You can obviously replace that limit with something else, or remove it which will then use the complete history of the repository.


Most productive hours in a day

git log --since=6.months --pretty=format:%cD | cut -d' ' -f5 | cut -d: -f1 | sort | uniq -c | sort -n

Most productive week days

git log --since=6.months --pretty=format:%cD | cut -d, -f1 | sort | uniq -c | sort -n

Most active developers

git shortlog -s -n --since=6.months

Most active days for a developer

Replace with an actual user: eg: paul
git log --since=6.months --pretty=format:%cD --author=<username> | cut -d, -f1 | sort | uniq -c | sort -n