General
PromptBeginner5 minmarkdown
<h1 align="center">
<a href="https://prompts.chat">
5
Sign in to like and favorite skills
This skill provides comprehensive git repository analysis covering team practices, commit patterns, velocity metrics, and codebase health. It leverages both native git commands and open source analysis tools to generate actionable insights.
To perform a comprehensive repository analysis:
scripts/check_tools.sh to verify available analysis toolsscripts/analyze_repo.sh for a full analysis reportQuick snapshot of the repository:
# If onefetch is installed - visual repo summary onefetch # Native git alternative git shortlog -sn --all | head -20 # Top contributors git rev-list --count HEAD # Total commits git branch -a | wc -l # Branch count
Commit Size Analysis:
# Average files changed per commit (last 100 commits) git log --oneline --shortstat -100 | grep "files\? changed" | awk '{sum+=$1; count++} END {print "Avg files/commit:", sum/count}' # Large commits (>10 files changed) - potential code review issues git log --oneline --shortstat | awk '/files? changed/ {if ($1 > 10) count++} END {print "Large commits (>10 files):", count}' # Commits with very short messages (<10 chars) - quality indicator git log --format="%s" | awk 'length($0) < 10 {count++} END {print "Short commit messages:", count}'
Commit Message Quality:
# Check for conventional commits format git log --format="%s" -100 | grep -cE "^(feat|fix|docs|style|refactor|test|chore|build|ci|perf|revert)(\(.+\))?:" # WIP/temp commits that should have been squashed git log --oneline --all | grep -ciE "(wip|temp|fixup|squash|xxx|todo)"
Co-authored commits (collaboration indicator):
git log --all --oneline --grep="Co-authored-by" -i | wc -l
# Active branches git branch -a --sort=-committerdate | head -20 # Branch naming patterns git branch -a | sed 's/.*\///' | cut -d'-' -f1 | sort | uniq -c | sort -rn # Stale branches (no commits in 30+ days) git for-each-ref --sort=committerdate --format='%(refname:short) %(committerdate:relative)' refs/heads | while read branch date; do if [[ "$date" == *"months"* ]] || [[ "$date" == *"year"* ]]; then echo "STALE: $branch ($date)" fi done # Merge vs rebase detection (merge commits ratio) total=$(git rev-list --count HEAD) merges=$(git rev-list --merges --count HEAD) echo "Merge commits: $merges / $total ($(( merges * 100 / total ))%)"
# Commits per week (last 12 weeks) git log --since="12 weeks ago" --format="%ai" | cut -d' ' -f1 | cut -d'-' -f1,2 | uniq -c # Commits per author (last 30 days) git shortlog -sn --since="30 days ago" # Daily commit distribution git log --format="%ad" --date=format:'%A' | sort | uniq -c | sort -rn # Hourly commit distribution (work hours indicator) git log --format="%ad" --date=format:'%H' | sort | uniq -c | sort -k2 -n
Using git-quick-stats (if installed):
git-quick-stats -T # Commits by date git-quick-stats -a # Detailed stats by author
# Bus factor - top contributors by percentage git shortlog -sn --all | awk 'NR==1{total=$1} {sum+=$1; print $1, $1*100/total"%", $2}' | head -10 # Using git-fame (if installed) - more detailed analysis git-fame --sort=commits --exclude="*.lock,*.json" # New contributors (first commit in last 90 days) git log --format="%an" --since="90 days ago" | sort -u | while read author; do first=$(git log --author="$author" --reverse --format="%ai" | head -1) if [[ "$first" > $(date -v-90d +%Y-%m-%d) ]]; then echo "NEW: $author (first commit: $first)" fi done
# Most frequently changed files (last 6 months) git log --since="6 months ago" --name-only --pretty=format: | sort | uniq -c | sort -rn | head -20 # Files changed together (coupling detection) git log --name-only --pretty=format: | grep -v '^$' | sort | uniq -c | sort -rn | head -30 # Bug fix frequency (files touched in "fix" commits) git log --all --oneline --grep="fix" --name-only | grep -v "^[a-f0-9]" | sort | uniq -c | sort -rn | head -15
# Tag history and frequency git tag -l --sort=-creatordate | head -20 # Time between releases git for-each-ref --sort=-creatordate --format='%(refname:short) %(creatordate:short)' refs/tags | head -10 # Commits since last tag git describe --tags --abbrev=0 2>/dev/null && git rev-list $(git describe --tags --abbrev=0)..HEAD --count
Using git-sizer (if installed):
git-sizer --verbose
Native alternatives:
# Repository size du -sh .git # Largest files in history git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | awk '/^blob/ {print $3, $4}' | sort -rn | head -20 # File type distribution git ls-files | sed 's/.*\.//' | sort | uniq -c | sort -rn | head -15
| Tool | Install | Best For |
|---|---|---|
| onefetch | | Quick visual repo summary |
| git-quick-stats | | Interactive stats menu |
| git-sizer | | Repo size/commit metrics |
| git-fame | | Contributor analysis |
| mergestat | | SQL queries on git |
To check which tools are available, run:
scripts/check_tools.sh
See
references/benchmarks.md for:
check_tools.sh - Detect installed analysis tools and suggest missing onesanalyze_repo.sh - Run comprehensive analysis and generate reportbenchmarks.md - Metric benchmarks, best practices thresholds, and interpretation guide