SuperAPI AI Directory

git-stats

Coding & development

View repository

Updated 10-16 09:05

About this skill

🔍 Git contribution statistics

Run the built-in script to quickly count contribution data for each author in the current repository.

📋 Usage

Run the script (the script path is relative to this skill directory):

bash <skill-dir>/scripts/git-stats.sh [range]

Parameter description

range The parameters control the statistics range and are passed directly to git log:

Usage Description
--all(default) 📊 Full history of all branches
No parameters 📊 Full history of the current branch
main..test 🔀 Differences of the test branch relative to main
--since="2026-01-01" 📅 Starting from a certain date
--since="2026-01-01" --until="2026-02-01" 📅 Specified date range
HEAD~50..HEAD 🔢 The most recent 50 commits

Examples

# 全部历史
bash <skill-dir>/scripts/git-stats.sh --all

# 本月统计
bash <skill-dir>/scripts/git-stats.sh '--since="2026-03-01"'

# 某分支 vs 主分支
bash <skill-dir>/scripts/git-stats.sh 'main..feature-branch'

📊 Output contents

One line per author, including:

  • 👤 Author name — different Git identities of the same person are automatically merged (transitive closure: same email with different names and same name with different emails can both be recognized)
  • 📊 Proportion bar — visualize commit proportion
  • 📝 Commits — number of commits and percentage
  • 📂 Files — number of distinct files modified (deduplicated)
  • ➕ Added / ➖ Removed / Net — lines added/deleted and net change
  • 📅 Time range — the dates from the first commit to the last commit

There is a summary card at the top (total commits, number of contributors, total additions/deletions, number of files), and a project total at the bottom.

⚠️ Notes

  • The first run on a large repository may take several tens of seconds (it needs to traverse the numstat of all commits)
  • The added/deleted line counts of binary files are not included in the statistics
  • If a merge commit has no actual diff, it is not counted in the file and line statistics
  • Author merging: uses a transitive closure algorithm; for example, if A has committed as name1 and name2 with email1, they will be automatically merged into one person
  • Compatible with both macOS and Linux