360 Secure SkillHub
360 安全技能中心

Git Stats

核心功能:支持贡献者排名、按语言统计代码行数、提交时段/月度趋势分析、文件类型占比。典型场景:分析本地或指定路径Git仓库,可筛选分支、时间范围,也能跳过代码行数统计提速。输入为命令行参数,输出支持可读文本或JSON格式,适配人工查看与程序调用。

johnnywang2001
johnnywang2001
热度 56.45
最近更新 2026-05-11 17:35:58
分类:开发依赖:代码执行 / 读写文件应用场景:DevOps / 数据处理 / 报告撰写

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add git-stats
Metadata
name
git-stats
description
Analyze git repository statistics including contributor rankings, lines of code by language, commit frequency by day/hour, monthly activity trends, and file type breakdowns. Use when asked to analyze a repo, show git stats, get contributor info, count lines of code, or visualize commit activity patterns.

Git Stats

Analyze any local git repository for contributor rankings, LOC by language, commit activity patterns, and monthly trends.

Quick Start

# Analyze current repo
python3 scripts/git_stats.py

# Analyze a specific repo
python3 scripts/git_stats.py /path/to/repo

# JSON output for further processing
python3 scripts/git_stats.py --json

# Filter by date range
python3 scripts/git_stats.py --since 2025-01-01 --until 2025-12-31

# Specific branch
python3 scripts/git_stats.py --branch main

# Skip LOC counting for faster results
python3 scripts/git_stats.py --no-loc

Output Sections

  • Top Contributors — ranked by commit count with email
  • Lines of Code — total files/lines, broken down by extension
  • File Types — file count by extension
  • Activity by Day — which days of the week get the most commits
  • Activity by Hour — peak coding hours
  • Monthly Trend — commit volume over the last 12 months (configurable with --months)

Options

Flag Description
--branch Analyze a specific branch
--since Only include commits after this date
--until Only include commits before this date
--months N Monthly trend window (default: 12)
--json Output as JSON for programmatic use
--no-loc Skip line counting (much faster on large repos)

Dependencies

  • git CLI (must be on PATH)
  • Python 3.8+ (stdlib only, no pip packages needed)