Skip to main content

Simple git commit statistics CLI tool

Project description

git-statistics

git-statistics is a lightweight command-line tool for analyzing Git commit history. It provides quick insights into commit activity without requiring any external dependencies or configuration files.

The tool is designed to be simple, script-friendly, and easy to install, making it suitable for daily developer workflows, code reviews, and basic repository analytics.

Features

  • Total commit count summary
  • Commit activity grouped by day
  • Top contributors by commit count
  • Commit message type classification (feat, fix, chore, refactor, test, other)
  • Detection of very short or empty commit messages
  • Most frequent commit messages
  • Busiest commit hour analysis
  • Filters by time range and author
  • Optional JSON output for automation
  • Quiet mode for scripting and CI usage

Requirements

  • Python 3.9 or newer
  • Git installed and available in PATH
  • Must be executed inside a Git repository

Installation

Install from PyPI:

pip install git-statistics

After installation, the git-stat command will be available globally.


Basic Usage

Run inside a Git repository:

git-stat

This will print a human-readable summary including total commits, top days, top authors, and commit types.

Command Line Options

Show help

git-stat --help

Filter commits by time

git-stat --since 7d
git-stat --since 2024-01-01

Filter commits by author

git-stat --author "Your Name"

Exclude merge commits

git-stat --no-merge

Limit output size

git-stat --limit 3

Limits the number of results shown for top days, authors, and messages.

Show only commit type statistics

git-stat --type-only

Show most frequent commit messages

git-stat --top-messages

Show busiest commit hour

git-stat --busiest-hour

Outputs the hour of the day with the highest number of commits.

JSON output

git-stat --json

Useful for piping into other tools or scripts.

Quiet mode

git-stat --quiet

Outputs minimal key-value pairs suitable for CI and shell scripts.

Show version

git-stat --version

Exit Codes

The command exits with the following status codes:

  • 0 — Successful execution
  • 1 — Not a Git repository
  • 2 — No commits matched the given filters

These exit codes are intended to make the tool easy to integrate into automation pipelines.

Example Output

Total commits: 124

Top days:
  2024-06-12: 15
  2024-06-10: 12

Top authors:
  Alice: 70
  Bob: 54

Commit types:
  feature: 40
  fix: 32
  chore: 18
  other: 34

Design Philosophy

  • No configuration files
  • No external Python dependencies
  • Single-purpose, focused analytics
  • Predictable and script-friendly output

The tool intentionally avoids complex visualization and long-running background processes.

License

MIT LICENSE

Contributing

Issues and pull requests are welcome. Keep changes small, focused, and consistent with the existing CLI behavior.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_statistics-0.1.3.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_statistics-0.1.3-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file git_statistics-0.1.3.tar.gz.

File metadata

  • Download URL: git_statistics-0.1.3.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for git_statistics-0.1.3.tar.gz
Algorithm Hash digest
SHA256 dd925bada1e2052fedead80c0ef4542538872d68a8e64d75aa0f527ab79bdd56
MD5 7822aac68cda26561618eadce55bf693
BLAKE2b-256 6d11701c196d3d10930c7c1ef9336ae05ef595caa06645c2cec454c62cfd3ed3

See more details on using hashes here.

File details

Details for the file git_statistics-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: git_statistics-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for git_statistics-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e16cc8e09e0e0c5319cae342260809ad2318ec14fba4962f815c1c5dbb94aa57
MD5 61ffd50588db6609227a77d2ce1c0c97
BLAKE2b-256 d0639132e956a552412e15fd03770432cfed69ea4b0ce3c26fcdf7059b045366

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page