Skip to content

lukehsiao/git-stats

Repository files navigation

📊
git stats

A tool for getting aggregated commit stats.


git-stats parses log information to get stats about the files changed, additions, and deletions. For example:

$ git stats -r origin..HEAD
Author           Commits  Changed Files  Insertions  Deletions  Net Δ
Luke Hsiao            67            117       +2616      -1126  +1490
dependabot[bot]       31             62        +203       -267    -64
Total                 98            179       +2819      -1393  +1426

Reviewer/Tester  Commits
Luke Hsiao             1

Install

Git Stats reads your repository directly with gitoxide, a pure-Rust implementation of git.

From crates.io

cargo install git-stats --locked

Or, if you use cargo-binstall:

cargo binstall git-stats

Usage

A tool for getting aggregated commit stats

Usage: git-stats [OPTIONS] [revision-range]

Arguments:
  [revision-range]  Show only commits in the specified revision range [default: HEAD]

Options:
  -e, --email            Show the email address of each author
  -r, --reviews          Show who reviewed/tested commits based on `Acked-by`, `Tested-by`, and `Reviewed-by` git trailers
  -s, --sort <SORT>      What column to sort by [default: commits] [possible values: author, commits, files, insertions, deletions, net]
      --reverse          Whether to reverse the sorting from descending to ascending
  -a, --author <AUTHOR>  Limit the commits output to ones with author header lines that match the specified pattern (regular expression)
      --since <SINCE>    Limit the commits output to ones more recent than a specific date
      --until <UNTIL>    Limit the commits output to ones older than a specific date
  -h, --help             Print help (see more with '--help')
  -V, --version          Print version

Notes

A few behaviors are worth knowing, mostly where reading git natively differs slightly from the porcelain:

  • Revision ranges. Single revisions, A..B, and A...B are supported, and each endpoint can be spelled any way gitoxide understands (refs, short hashes, @{n}, and so on). More exotic gitrevisions(7) forms are not interpreted.
  • --since / --until. Accepts ISO 8601, RFC 2822, unix timestamps, and relative dates like "2 weeks ago". This is a subset of git's full approxidate, and filtering is on the committer date.
  • --author. Matches against the mailmap-resolved author (Name <email>), whereas git log --author matches the raw author header. These differ only for repositories that carry a .mailmap.
  • Merge commits count as commits but contribute no line or file changes, matching the default of git log --numstat.
  • Line counts come from gitoxide's diff engine, which can differ from git's by a tiny margin on some hunks (a different but equally valid diff). File and net counts match git's rename-aware output.

About

📊 A tool for getting aggregated commit stats

Topics

Resources

License

Stars

Watchers

Forks

Contributors