git-biance

Crates.iogit-biance
lib.rsgit-biance
version
sourcesrc
created_at2025-02-11 20:30:13.049018+00
updated_at2025-02-21 08:09:26.543499+00
descriptionA small program that shows and visualizes code contributions in a git repository.
homepagehttps://github.com/xiaoshihou514/git-biance
repositoryhttps://github.com/xiaoshihou514/git-biance
max_upload_size
id1551952
Cargo.toml error:TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
xiaoshihou (xiaoshihou514)

documentation

README

git-biance

中文文档

biance(鞭策,biān cè,spur)is a small rust program that shows and visualizes code contributions in a git repository.

⚠️*Do not* use it to harass your teammates⚠️
git biance --commits --plot git biance --stat --plot
commits stats

Installation

cargo install git-biance

Usage

Usage: git-biance [OPTIONS] [AUTHOR]

Arguments:
  [AUTHOR]  Specify certain author

Options:
  -s, --stat            Show total insertions and deletions
  -c, --commits         Show total commits
  -p, --plot            Visualize contributions with a graph
  -f, --file <FILE>...  Show insertions and deletions on single file
  -h, --help            Print help
  -V, --version         Print version

Integrations

GitLab Integration

The following workflow can be used to achieve automatic spurring effect in merge requests, requires environment variable named CI_AUTOCOMMENTER_API_KEY containing a personal access code:

# Don't forget to change the gitlab instance
biance:
  stage: deploy
  variables:
    GIT_DEPTH: 0
  script:
    - BIANCE_COMMIT=$(git biance -c | sed ':a; N; $!ba; s/ /%20/g; s/\n/%0A/g')
    - BIANCE_STATS=$(find src/main/ -type f | xargs git biance -f | sed ':a; N; $!ba; s/ /%20/g; s/\n/%0A/g')
    - BIANCE_MSG=$(echo "Beep%20boop%0A%0A$BIANCE_COMMIT%0A%0A$BIANCE_STATS")
    - 'curl --request POST --header "PRIVATE-TOKEN: $CI_AUTOCOMMENTER_API_KEY" "https://your.gitlab.instance.com/api/v4/projects/$CI_PROJECT_ID/merge_requests/$CI_MERGE_REQUEST_IID/notes?body=$BIANCE_MSG"'
  rules:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'

Effect

FAQ

I see some names are repeated, what is going on?

git-biance use email to identify users, but shows them by user name. It's likely that some contributors are using git with http, which generates a new email each time they push a commit. One can get the correct output by using git mailmap. To get a list of authors, run:

git log | grep Author | sort | uniq
Commit count: 14

cargo fmt