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.2.tar.gz (5.3 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.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_statistics-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 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.2.tar.gz
Algorithm Hash digest
SHA256 6ec175069bafbf15c439a8dc328f2d9a28c59bf20882a3156d9b4767c7658a3e
MD5 102ddab13013b4afc42b2bedac79cb6e
BLAKE2b-256 5e16cdeb7a4900f95acda6c9153ff0ef84fc194cb948c052bb0cae96668cc9c7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: git_statistics-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8c17fcc04faf6cecc4f038885d78ecc775a57292631d1167f0e06a0e69f67ef0
MD5 8b4e3401d92504107c7df41da33d3355
BLAKE2b-256 1c737d07acbad221c3e4cf5ae111d3cfa40ccd06d65fcd7720659dd1e08b298b

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