Git & Version Controlbeginner
Generate repository statistics (contributors, commit frequency, file changes)
Repo Stats
Generate repository statistics (contributors, commit frequency, file changes)
Generate repository statistics and visualize contribution patterns.
Instructions
- Contributor statistics:
git shortlog -sn --all --no-merges # commits per author
git log --format='%aN' | sort | uniq -c | sort -rn | head -10
- Commit frequency:
# Commits per day of week
git log --format='%ad' --date=format:'%A' | sort | uniq -c | sort -rn
# Commits per month
git log --format='%ad' --date=format:'%Y-%m' | sort | uniq -c
# Commits per hour (find peak coding hours)
git log --format='%ad' --date=format:'%H' | sort | uniq -c | sort -rn
- File change frequency (find hotspots):
git log --pretty=format: --name-only | sort | uniq -c | sort -rn | head -20
- Code churn (lines added/removed):
git log --shortstat --since="1 month ago" | grep "files changed" | \
awk '{i+=$4; d+=$6} END {print "Added:", i, "Deleted:", d}'
- Repository age and size:
echo "First commit:" $(git log --reverse --format='%ai' | head -1)
echo "Total commits:" $(git rev-list --count HEAD)
echo "Branches:" $(git branch -a | wc -l)
echo "Tags:" $(git tag | wc -l)
Output Format
Present as a formatted summary with key insights (e.g., "most active day is Tuesday", "src/api/ has the most churn").