Coder Social home page Coder Social logo

git-statistics's Introduction

Git Statistics

中文

app-icon

Collect commits from Git repository and present statistics in a comfortable way.

Features

  • Commits statistics for each user, including the following dimensions of information.

    1. The number of commits
    2. The number of files changed
    3. The number of insertions
    4. The number of deletions
    5. The number of lines changed (insertions + deletions)

    The statistical results will exclude merges and will not include modifications that have been marked as renames or moves. You can specify a PATHSPEC to perform more precise matching on top of this.

Installation

Installing from crates.io:

cargo install git-statistics

Or you can build it yourself from source, clone the repository:

git clone https://github.com/hyzmm/git-statistics
cd git-statistics

Install CLI locally:

cargo install --path .

If you want to experience the UI version of the application, you can run the following command:

cargo tauri dev

Or make an application installer, run the following command to build it:

cd app/
npm i
npm run build
cargo tauri build

On macOS, the generated installation package is located in target/release/bundle/dmg.

CLI Usage

Type git stats -h to see the full help message:

git stats -h
This tool provides comprehensive statistics for each user in the current repository.

Usage: git-stats [OPTIONS] [-- <PATHSPEC>...]

Arguments:
  [PATHSPEC]...  A glob pattern to match against file paths. src, *.rs, or src/**/*.rs etc

Options:
  -s, --sort <SORT>            Sort by the specified column. The default is unordered [possible values: commits, files-changed, insertions, deletions, lines-changed]
  -c, --max-count <MAX_COUNT>  Limit the number of ros to show
  -h, --help                   Print help (see more with '--help')
  -V, --version                Print version

Here is an example of statistics in the bevy repository, go to the repository directory and run it:

$ git stats -c 5 -s commits
██████████████████████████████████████████████████████████████████████ 2820/2820
┌──────────────┬─────────┬─────────┬──────────────┬──────────────┬─────────────┐
│ Author       ┆ Commits ┆ Files   ┆ Insertions   ┆ Deletions    ┆ Lines       │
│              ┆         ┆ Changed ┆              ┆              ┆ Changed     │
╞══════════════╪═════════╪═════════╪══════════════╪══════════════╪═════════════╡
│ Carter       ┆ 1059    ┆ 16247   ┆ 723427       ┆ 682678       ┆ 1406105     │
│ Anderson     ┆ (72%)   ┆ (89%)   ┆ (94%)        ┆ (98%)        ┆ (96%)       │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ François     ┆ 214     ┆ 995     ┆ 17871        ┆ 7333         ┆ 25204       │
│              ┆ (15%)   ┆ (5%)    ┆ (2%)         ┆ (1%)         ┆ (2%)        │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Robert Swain ┆ 76      ┆ 421     ┆ 18941        ┆ 3401         ┆ 22342       │
│              ┆ (5%)    ┆ (2%)    ┆ (2%)         ┆ (0%)         ┆ (2%)        │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Jakob        ┆ 62      ┆ 250     ┆ 4825         ┆ 1516         ┆ 6341        │
│ Hellermann   ┆ (4%)    ┆ (1%)    ┆ (1%)         ┆ (0%)         ┆ (0%)        │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Daniel McNab ┆ 57      ┆ 248     ┆ 2508         ┆ 2711         ┆ 5219        │
│              ┆ (4%)    ┆ (1%)    ┆ (0%)         ┆ (0%)         ┆ (0%)        │
└──────────────┴─────────┴─────────┴──────────────┴──────────────┴─────────────┘

This means printing the top 5 authors with the highest number of commits.

The CLI has the following arguments:

Argument Description
sort The sorting method for users, which is unordered by default. It can be sorted by 5 dimensions: commits, files-changed, insertions, deletions, lines-changed.
max-count Limit the number of ros to show.
PATHSPEC A glob pattern to match against file paths. src, *.rs, or src/**/*.rs etc.
Prefix with :! to exclude the specified paths, for example: git stats -- ':!src/assets' to exclude all files in src/assets.

Match specified paths

Here is an example that only counts all files in the src directory, and rs files in the crates directory.

git stats -s commits -c 5 -- src crates/**/*.rs

Exclude specified paths

git stats -s commits -c 5 -- src crates ':!crates/bevy_core'

The format of the exclusion path is the same as that of the matching path, but paths prefixed with :! will be excluded from the statistical results.

Application

Here are some screenshots of the app:

screenshots

TODO

  • More statistical methods.
  • Provide more installation channels.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.