From 4d2e52aa6d7585ef323076d3f41de7f77638686d Mon Sep 17 00:00:00 2001 From: arzzen Date: Sun, 22 Jun 2025 19:49:49 +0200 Subject: [PATCH] commits heatmap --- README.md | 852 +++++++++++++++++++++-------------------- git-quick-stats | 111 +++++- git-quick-stats.1 | 417 ++++++++++---------- tests/commands_test.sh | 10 +- 4 files changed, 755 insertions(+), 635 deletions(-) diff --git a/README.md b/README.md index 305ebe3..6989b2c 100644 --- a/README.md +++ b/README.md @@ -1,420 +1,432 @@ -# GIT quick statistics [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Simple%20and%20efficient%20way%20to%20access%20various%20statistics%20in%20git%20repository&url=https://github.com/arzzen/git-quick-stat&via=arzzen&hashtags=git,stats,tool,statistics,developers) - -[![Homebrew package](https://repology.org/badge/version-for-repo/homebrew/git-quick-stats.svg)](https://formulae.brew.sh/formula/git-quick-stats#default) - -> `git-quick-stats` is a simple and efficient way to access various statistics in a git repository. -> -> Any git repository may contain tons of information about commits, contributors, and files. Extracting this information is not always trivial, mostly because there are a gadzillion options to a gadzillion git commands - I don't think there is a single person alive who knows them all. Probably not even [Linus Torvalds](https://github.com/torvalds) himself :). - -![mainImageScreenshot](https://github.com/user-attachments/assets/7d8637a4-5a67-49f6-8724-ca7548b987c6) - - -## Table of Contents - -[**Screenshots**](#screenshots) - -[**Usage**](#usage) - -- [**Interactive**](#interactive) -- [**Non-interactive**](#non-interactive) -- [**Command-line arguments**](#command-line-arguments) -- [**Git log since and until**](#git-log-since-and-until) -- [**Git log limit**](#git-log-limit) -- [**Git log options**](#git-log-options) -- [**Git pathspec**](#git-pathspec) -- [**Git merge view strategy**](#git-merge-view-strategy) -- [**Color themes**](#color-themes) - -[**Installation**](#installation) - -- [**UNIX and Linux**](#unix-and-linux) -- [**macOS**](#macos-homebrew) -- [**Windows**](#windows) -- [**Docker**](#docker) - -[**System requirements**](#system-requirements) - -- [**Dependencies**](#dependencies) - -[**FAQ**](#faq) - -[**Contribution**](#contribution) - -- [**Code reviews**](#code-reviews) -- [**Some tips for good pull requests**](#some-tips-for-good-pull-requests) -- [**Formatting**](#formatting) - -[**Tests**](#tests) - -[**Licensing**](#licensing) - -[**Contributors**](#contributors) - -- [**Backers**](#backers) -- [**Sponsors**](#sponsors) - -## Screenshots - -![commitsByWeekdayScreenshot](https://github.com/user-attachments/assets/3496d245-6385-47d1-878a-726e79100eb1) - -![commitsByHourScreenshot](https://github.com/user-attachments/assets/9f1d69d9-46e0-411d-a5ed-905ffdfb887a) - -![commitActivityScreenshot](https://github.com/user-attachments/assets/693fff31-65c7-4b9f-a011-6114a2d10a26) - - -## Usage - -### Interactive - -`git-quick-stats` has a built-in interactive menu that can be executed as such: - -```bash -git-quick-stats -``` - -Or - -```bash -git quick-stats -``` - -### Non-interactive - -For those who prefer to utilize command-line options, `git-quick-stats` also has a non-interactive mode supporting both short and long options: - -```bash -git-quick-stats -``` - -Or - -```bash -git quick-stats -``` - -### Command-line arguments - -Possible arguments in short and long form: - -```bash -GENERATE OPTIONS - -T, --detailed-git-stats - give a detailed list of git stats - -R, --git-stats-by-branch - see detailed list of git stats by branch - -c, --changelogs - see changelogs - -L, --changelogs-by-author - see changelogs by author - -S, --my-daily-stats - see your current daily stats - -V, --csv-output-by-branch - output daily stats by branch in CSV format - -j, --json-output - save git log as a JSON formatted file to a specified area - -LIST OPTIONS - -b, --branch-tree - show an ASCII graph of the git repo branch history - -D, --branches-by-date - show branches by date - -C, --contributors - see a list of everyone who contributed to the repo - -n, --new-contributors - list everyone who made their first contribution since a specified date - -a, --commits-per-author - displays a list of commits per author - -d, --commits-per-day - displays a list of commits per day - -Y, --commits-by-year - displays a list of commits per year - -m, --commits-by-month - displays a list of commits per month - -w, --commits-by-weekday - displays a list of commits per weekday - -W, --commits-by-author-by-weekday - displays a list of commits per weekday by author - -o, --commits-by-hour - displays a list of commits per hour - -A, --commits-by-author-by-hour - displays a list of commits per hour by author - -z, --commits-by-timezone - displays a list of commits per timezone - -Z, --commits-by-author-by-timezone - displays a list of commits per timezone by author - -SUGGEST OPTIONS - -r, --suggest-reviewers - show the best people to contact to review code - -h, -?, --help - display this help text in the terminal -``` - -### Git log since and until - -You can set the variables `_GIT_SINCE` and/or `_GIT_UNTIL` before running `git-quick-stats` to limit the git log. These work similar to git's built-in `--since` and `--until` log options. - -```bash -export _GIT_SINCE="2017-01-20" -export _GIT_UNTIL="2017-01-22" -``` - -Once set, run `git quick-stats` as normal. Note that this affects all stats that parse the git log history until unset. - -### Git log limit - -You can set variable `_GIT_LIMIT` for limited output. It will affect the "changelogs" and "branch tree" options. The default limit is `10`. - -```bash -export _GIT_LIMIT=20 -``` - -### Git log options - -You can set `_GIT_LOG_OPTIONS` for [git log options](https://git-scm.com/docs/git-log#_options): - -```bash -export _GIT_LOG_OPTIONS="--ignore-all-space --ignore-blank-lines" -``` - -### Git pathspec - -You can exclude a directory from the stats by using [pathspec](https://git-scm.com/docs/gitglossary#gitglossary-aiddefpathspecapathspec) - -```bash -export _GIT_PATHSPEC=':!directory' -``` - -You can also exclude files from the stats. Note that it works with any alphanumeric, glob, or regex that git respects. - -```bash -export _GIT_PATHSPEC=':!package-lock.json' -``` - -### Git merge view strategy - -You can set the variable `_GIT_MERGE_VIEW` to enable merge commits to be part of the stats by setting `_GIT_MERGE_VIEW` to `enable`. You can also choose to only show merge commits by setting `_GIT_MERGE_VIEW` to `exclusive`. Default is to not show merge commits. These work similar to git's built-in `--merges` and `--no-merges` log options. - -```bash -export _GIT_MERGE_VIEW="enable" -export _GIT_MERGE_VIEW="exclusive" -``` - -### Git branch - -You can set the variable `_GIT_BRANCH` to set the branch of the stats. Works with commands `--git-stats-by-branch` and `--csv-output-by-branch`. - -```bash -export _GIT_BRANCH="master" -``` - -### Ignore authors - -You can set the variable `_GIT_IGNORE_AUTHORS` to filter out specific authors. It will affect the "All contributors", ""Suggested code reviewers" and "New contributors" options. - -```bash -export _GIT_IGNORE_AUTHORS="(author@examle.com|username)" -``` - -### Sorting contribution stats - -You can sort contribution stats by field `name`, `commits`, `insertions`, `deletions`, or `lines` (total lines changed) and order (`asc`, `desc`). e.g.: `commits-desc` - -```bash -export _GIT_SORT_BY="name-asc" -``` - -### Color themes - -You can change to the legacy color scheme by toggling the variable `_MENU_THEME` between `default` and `legacy`. -You can completely disable the color theme by setting the `_MENU_THEME` variable to `none`. - -```bash -export _MENU_THEME="legacy" -# or -export _MENU_THEME="none" -``` - -![legacyThemeScreenshot](https://github.com/user-attachments/assets/3b319c1a-827f-47b8-bbfa-b8b59a39deef) - -## Installation - -### Debian and Ubuntu - -If you are on at least Debian Bullseye or Ubuntu Focal you can use apt for installation: - -```bash -apt install git-quick-stats -``` - -### UNIX and Linux - -```bash -git clone https://github.com/git-quick-stats/git-quick-stats.git && cd git-quick-stats -sudo make install -``` - -For uninstalling, open up the cloned directory and run - -```bash -sudo make uninstall -``` - -For update/reinstall - -```bash -sudo make reinstall -``` - -### macOS (homebrew) - -macOS requires GNU coreutils to be installed and for the non "g" aliased -versions to be exported to your path. The following is an example of how to -perform this if you are using Homebrew as your package manager. - -```bash -brew install coreutils -export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH" -``` - -From there, you can install via Homebrew as follows: - -```bash -brew install git-quick-stats -``` - -Or you can follow the UNIX and Linux instructions if you wish. - -If you would like to default to using the GNU coreutils (recommended), then you -can add `export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"` to -your applicable `~/.bash_profile`, `~/.zprofile`, or other relevant profile -based on the shell of your choice. - -### Windows - -If you are installing with Cygwin, use these scripts: - -- [installer](https://gist.github.com/arzzen/35e09866dfdadf2108b2420045739245) -- [uninstaller](https://gist.github.com/arzzen/21c660014d0663b6c5710014714779d6) - -If you are wishing to use this with WSL, follow the UNIX and Linux instructions. - -### Docker - -You can use the Docker image provided: - -- Build: `docker build -t arzzen/git-quick-stats .` -- Run interactive menu: `docker run --rm -it -v $(pwd):/git arzzen/git-quick-stats` -- Docker pull command: `docker pull arzzen/git-quick-stats` [docker repository](https://hub.docker.com/r/arzzen/git-quick-stats) - -## System requirements - -- An OS with a Bash shell -- Tools we use: - -```bash -awk -basename -cat -column -date -echo -git -grep -head -printf -seq -sort -tput -tr -uniq -``` - -### Dependencies - -- [`bsdextrautils`](https://packages.debian.org/sid/bsdextrautils) `apt install bsdextrautils` -- [`coreutils`](https://packages.debian.org/sid/coreutils) `apt install coreutils` -- [`gawk`](https://packages.debian.org/sid/gawk) `apt install gawk` -- [`grep`](https://packages.debian.org/sid/grep) `apt install grep` -- [`ncurses-bin`](https://packages.debian.org/sid/ncurses-bin) `apt install ncurses-bin` - -## FAQ - -_Q:_ I get some errors after run git-quick-stats in cygwin like `/usr/local/bin/git-quick-stats: line 2: $'\r': command not found` - -_A:_ You can run the dos2unix app in cygwin as follows: `/bin/dos2unix.exe /usr/local/bin/git-quick-stats`. This will convert the script from the CR-LF convention that Microsoft uses to the LF convention that UNIX, OS X, and Linux use. You should then should be able to run it as normal. - -_Q:_ How they could be used in a project with many git projects and statistics would show a summary of all git projects? - -_A:_ If you want to include submodule logs, you can try using the following: `export _GIT_LOG_OPTIONS="-p --submodule=log"` -(more info about [git log --submodule](https://git-scm.com/docs/git-log#Documentation/git-log.txt---submoduleltformatgt)) - -## Contribution - -Want to contribute? Great! First, read this page. - -### Code reviews - -All submissions, including submissions by project members, require review.
-We use GitHub pull requests for this purpose. - -### Some tips for good pull requests - -- Use our code
- When in doubt, try to stay true to the existing code of the project. -- Write a descriptive commit message. What problem are you solving and what - are the consequences? Where and what did you test? Some good tips: - [here](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message) - and [here](https://www.kernel.org/doc/Documentation/SubmittingPatches). -- If your PR consists of multiple commits which are successive improvements / - fixes to your first commit, consider squashing them into a single commit - (`git rebase -i`) such that your PR is a single commit on top of the current - HEAD. This make reviewing the code so much easier, and our history more - readable. - -### Formatting - -This documentation is written using standard [markdown syntax](https://help.github.com/articles/markdown-basics/). Please submit your changes using the same syntax. - -## Tests - -[![codecov](https://codecov.io/gh/arzzen/git-quick-stats/branch/master/graph/badge.svg)](https://codecov.io/gh/arzzen/git-quick-stats) - -```bash -make test -``` - -## Licensing - -MIT see [LICENSE][] for the full license text. - -[read this page]: http://github.com/git-quick-stats/git-quick-stats/blob/master/.github/CONTRIBUTING.md -[landing page]: https://git-quick-stats.sh -[LICENSE]: https://github.com/git-quick-stats/git-quick-stats/blob/master/LICENSE - -## Contributors - -This project exists thanks to all the people who contribute. - -[![contributors](https://opencollective.com/git-quick-stats/contributors.svg?width=890&button=false)](https://github.com/git-quick-stats/git-quick-stats/graphs/contributors) - -### Backers - -Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/git-quick-stats#backer)] - -[![backers](https://opencollective.com/git-quick-stats/backers.svg?width=890)](https://opencollective.com/git-quick-stats#backers) - -### Sponsors - -Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/git-quick-stats#sponsor)] - -[![sponsor0](https://opencollective.com/git-quick-stats/sponsor/0/avatar.svg?v=1)](https://opencollective.com/git-quick-stats/sponsor/0/website) -[![sponsor1](https://opencollective.com/git-quick-stats/sponsor/1/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/1/website) -[![sponsor2](https://opencollective.com/git-quick-stats/sponsor/2/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/2/website) -[![sponsor3](https://opencollective.com/git-quick-stats/sponsor/3/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/3/website) -[![sponsor4](https://opencollective.com/git-quick-stats/sponsor/4/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/4/website) -[![sponsor5](https://opencollective.com/git-quick-stats/sponsor/5/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/5/website) -[![sponsor6](https://opencollective.com/git-quick-stats/sponsor/6/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/6/website) -[![sponsor7](https://opencollective.com/git-quick-stats/sponsor/7/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/7/website) -[![sponsor8](https://opencollective.com/git-quick-stats/sponsor/8/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/8/website) -[![sponsor9](https://opencollective.com/git-quick-stats/sponsor/9/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/9/website) +# GIT quick statistics [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=Simple%20and%20efficient%20way%20to%20access%20various%20statistics%20in%20git%20repository&url=https://github.com/arzzen/git-quick-stat&via=arzzen&hashtags=git,stats,tool,statistics,developers) + +[![Homebrew package](https://repology.org/badge/version-for-repo/homebrew/git-quick-stats.svg)](https://formulae.brew.sh/formula/git-quick-stats#default) + +> `git-quick-stats` is a simple and efficient way to access various statistics in a git repository. +> +> Any git repository may contain tons of information about commits, contributors, and files. Extracting this information is not always trivial, mostly because there are a gadzillion options to a gadzillion git commands - I don't think there is a single person alive who knows them all. Probably not even [Linus Torvalds](https://github.com/torvalds) himself :). + +![mainImageScreenshot](https://github.com/user-attachments/assets/7d8637a4-5a67-49f6-8724-ca7548b987c6) + +## Table of Contents + +[**Screenshots**](#screenshots) + +[**Usage**](#usage) + +- [**Interactive**](#interactive) +- [**Non-interactive**](#non-interactive) +- [**Command-line arguments**](#command-line-arguments) +- [**Git log since and until**](#git-log-since-and-until) +- [**Git log limit**](#git-log-limit) +- [**Git log options**](#git-log-options) +- [**Git pathspec**](#git-pathspec) +- [**Git merge view strategy**](#git-merge-view-strategy) +- [**Color themes**](#color-themes) + +[**Installation**](#installation) + +- [**UNIX and Linux**](#unix-and-linux) +- [**macOS**](#macos-homebrew) +- [**Windows**](#windows) +- [**Docker**](#docker) + +[**System requirements**](#system-requirements) + +- [**Dependencies**](#dependencies) + +[**FAQ**](#faq) + +[**Contribution**](#contribution) + +- [**Code reviews**](#code-reviews) +- [**Some tips for good pull requests**](#some-tips-for-good-pull-requests) +- [**Formatting**](#formatting) + +[**Tests**](#tests) + +[**Licensing**](#licensing) + +[**Contributors**](#contributors) + +- [**Backers**](#backers) +- [**Sponsors**](#sponsors) + +## Screenshots + +![commitsByWeekdayScreenshot](https://github.com/user-attachments/assets/3496d245-6385-47d1-878a-726e79100eb1) + +![commitsByHourScreenshot](https://github.com/user-attachments/assets/9f1d69d9-46e0-411d-a5ed-905ffdfb887a) + +![commitActivityScreenshot](https://github.com/user-attachments/assets/693fff31-65c7-4b9f-a011-6114a2d10a26) + +## Usage + +### Interactive + +`git-quick-stats` has a built-in interactive menu that can be executed as such: + +```bash +git-quick-stats +``` + +Or + +```bash +git quick-stats +``` + +### Non-interactive + +For those who prefer to utilize command-line options, `git-quick-stats` also has a non-interactive mode supporting both short and long options: + +```bash +git-quick-stats +``` + +Or + +```bash +git quick-stats +``` + +### Command-line arguments + +Possible arguments in short and long form: + +```bash +GENERATE OPTIONS + -T, --detailed-git-stats + give a detailed list of git stats + -R, --git-stats-by-branch + see detailed list of git stats by branch + -c, --changelogs + see changelogs + -L, --changelogs-by-author + see changelogs by author + -S, --my-daily-stats + see your current daily stats + -V, --csv-output-by-branch + output daily stats by branch in CSV format + -j, --json-output + save git log as a JSON formatted file to a specified area + +LIST OPTIONS + -b, --branch-tree + show an ASCII graph of the git repo branch history + -D, --branches-by-date + show branches by date + -C, --contributors + see a list of everyone who contributed to the repo + -n, --new-contributors + list everyone who made their first contribution since a specified date + -a, --commits-per-author + displays a list of commits per author + -d, --commits-per-day + displays a list of commits per day + -m, --commits-by-month + displays a list of commits per month + -Y, --commits-by-year + displays a list of commits per year + -w, --commits-by-weekday + displays a list of commits per weekday + -W, --commits-by-author-by-weekday + displays a list of commits per weekday by author + -o, --commits-by-hour + displays a list of commits per hour + -A, --commits-by-author-by-hour + displays a list of commits per hour by author + -z, --commits-by-timezone + displays a list of commits per timezone + -Z, --commits-by-author-by-timezone + displays a list of commits per timezone by author + +CALENDAR OPTIONS + -k, --commits-calendar-by-author + shows a calendar heatmap of commits per day-of-week per month for a given author + -H, --commits-heatmap + shows a heatmap of commits per day-of-week per month for the last 30 days + +SUGGEST OPTIONS + -r, --suggest-reviewers + show the best people to contact to review code + -h, -?, --help + display this help text in the terminal +``` + +### Git log since and until + +You can set the variables `_GIT_SINCE` and/or `_GIT_UNTIL` before running `git-quick-stats` to limit the git log. These work similar to git's built-in `--since` and `--until` log options. + +```bash +export _GIT_SINCE="2017-01-20" +export _GIT_UNTIL="2017-01-22" +``` + +Once set, run `git quick-stats` as normal. Note that this affects all stats that parse the git log history until unset. + +### Git log limit + +You can set variable `_GIT_LIMIT` for limited output. It will affect the "changelogs" and "branch tree" options. The default limit is `10`. + +```bash +export _GIT_LIMIT=20 +``` + +### Git log options + +You can set `_GIT_LOG_OPTIONS` for [git log options](https://git-scm.com/docs/git-log#_options): + +```bash +export _GIT_LOG_OPTIONS="--ignore-all-space --ignore-blank-lines" +``` + +### Git pathspec + +You can exclude a directory from the stats by using [pathspec](https://git-scm.com/docs/gitglossary#gitglossary-aiddefpathspecapathspec) + +```bash +export _GIT_PATHSPEC=':!directory' +``` + +You can also exclude files from the stats. Note that it works with any alphanumeric, glob, or regex that git respects. + +```bash +export _GIT_PATHSPEC=':!package-lock.json' +``` + +### Git merge view strategy + +You can set the variable `_GIT_MERGE_VIEW` to enable merge commits to be part of the stats by setting `_GIT_MERGE_VIEW` to `enable`. You can also choose to only show merge commits by setting `_GIT_MERGE_VIEW` to `exclusive`. Default is to not show merge commits. These work similar to git's built-in `--merges` and `--no-merges` log options. + +```bash +export _GIT_MERGE_VIEW="enable" +export _GIT_MERGE_VIEW="exclusive" +``` + +### Git branch + +You can set the variable `_GIT_BRANCH` to set the branch of the stats. Works with commands `--git-stats-by-branch` and `--csv-output-by-branch`. + +```bash +export _GIT_BRANCH="master" +``` + +### Ignore authors + +You can set the variable `_GIT_IGNORE_AUTHORS` to filter out specific authors. It will affect the "All contributors", ""Suggested code reviewers" and "New contributors" options. + +```bash +export _GIT_IGNORE_AUTHORS="(author@examle.com|username)" +``` + +### Sorting contribution stats + +You can sort contribution stats by field `name`, `commits`, `insertions`, `deletions`, or `lines` (total lines changed) and order (`asc`, `desc`). e.g.: `commits-desc` + +```bash +export _GIT_SORT_BY="name-asc" +``` + +### Commit days + +You can set \_GIT_DAYS to set the number of days for the heatmap + +```bash +export _GIT_DAYS=30 +``` + +### Color themes + +You can change to the legacy color scheme by toggling the variable `_MENU_THEME` between `default` and `legacy`. +You can completely disable the color theme by setting the `_MENU_THEME` variable to `none`. + +```bash +export _MENU_THEME="legacy" +# or +export _MENU_THEME="none" +``` + +![legacyThemeScreenshot](https://github.com/user-attachments/assets/3b319c1a-827f-47b8-bbfa-b8b59a39deef) + +## Installation + +### Debian and Ubuntu + +If you are on at least Debian Bullseye or Ubuntu Focal you can use apt for installation: + +```bash +apt install git-quick-stats +``` + +### UNIX and Linux + +```bash +git clone https://github.com/git-quick-stats/git-quick-stats.git && cd git-quick-stats +sudo make install +``` + +For uninstalling, open up the cloned directory and run + +```bash +sudo make uninstall +``` + +For update/reinstall + +```bash +sudo make reinstall +``` + +### macOS (homebrew) + +macOS requires GNU coreutils to be installed and for the non "g" aliased +versions to be exported to your path. The following is an example of how to +perform this if you are using Homebrew as your package manager. + +```bash +brew install coreutils +export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH" +``` + +From there, you can install via Homebrew as follows: + +```bash +brew install git-quick-stats +``` + +Or you can follow the UNIX and Linux instructions if you wish. + +If you would like to default to using the GNU coreutils (recommended), then you +can add `export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"` to +your applicable `~/.bash_profile`, `~/.zprofile`, or other relevant profile +based on the shell of your choice. + +### Windows + +If you are installing with Cygwin, use these scripts: + +- [installer](https://gist.github.com/arzzen/35e09866dfdadf2108b2420045739245) +- [uninstaller](https://gist.github.com/arzzen/21c660014d0663b6c5710014714779d6) + +If you are wishing to use this with WSL, follow the UNIX and Linux instructions. + +### Docker + +You can use the Docker image provided: + +- Build: `docker build -t arzzen/git-quick-stats .` +- Run interactive menu: `docker run --rm -it -v $(pwd):/git arzzen/git-quick-stats` +- Docker pull command: `docker pull arzzen/git-quick-stats` [docker repository](https://hub.docker.com/r/arzzen/git-quick-stats) + +## System requirements + +- An OS with a Bash shell +- Tools we use: + +```bash +awk +basename +cat +column +date +echo +git +grep +head +printf +seq +sort +tput +tr +uniq +``` + +### Dependencies + +- [`bsdextrautils`](https://packages.debian.org/sid/bsdextrautils) `apt install bsdextrautils` +- [`coreutils`](https://packages.debian.org/sid/coreutils) `apt install coreutils` +- [`gawk`](https://packages.debian.org/sid/gawk) `apt install gawk` +- [`grep`](https://packages.debian.org/sid/grep) `apt install grep` +- [`ncurses-bin`](https://packages.debian.org/sid/ncurses-bin) `apt install ncurses-bin` + +## FAQ + +_Q:_ I get some errors after run git-quick-stats in cygwin like `/usr/local/bin/git-quick-stats: line 2: $'\r': command not found` + +_A:_ You can run the dos2unix app in cygwin as follows: `/bin/dos2unix.exe /usr/local/bin/git-quick-stats`. This will convert the script from the CR-LF convention that Microsoft uses to the LF convention that UNIX, OS X, and Linux use. You should then should be able to run it as normal. + +_Q:_ How they could be used in a project with many git projects and statistics would show a summary of all git projects? + +_A:_ If you want to include submodule logs, you can try using the following: `export _GIT_LOG_OPTIONS="-p --submodule=log"` +(more info about [git log --submodule](https://git-scm.com/docs/git-log#Documentation/git-log.txt---submoduleltformatgt)) + +## Contribution + +Want to contribute? Great! First, read this page. + +### Code reviews + +All submissions, including submissions by project members, require review.
+We use GitHub pull requests for this purpose. + +### Some tips for good pull requests + +- Use our code
+ When in doubt, try to stay true to the existing code of the project. +- Write a descriptive commit message. What problem are you solving and what + are the consequences? Where and what did you test? Some good tips: + [here](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message) + and [here](https://www.kernel.org/doc/Documentation/SubmittingPatches). +- If your PR consists of multiple commits which are successive improvements / + fixes to your first commit, consider squashing them into a single commit + (`git rebase -i`) such that your PR is a single commit on top of the current + HEAD. This make reviewing the code so much easier, and our history more + readable. + +### Formatting + +This documentation is written using standard [markdown syntax](https://help.github.com/articles/markdown-basics/). Please submit your changes using the same syntax. + +## Tests + +[![codecov](https://codecov.io/gh/arzzen/git-quick-stats/branch/master/graph/badge.svg)](https://codecov.io/gh/arzzen/git-quick-stats) + +```bash +make test +``` + +## Licensing + +MIT see [LICENSE][] for the full license text. + +[read this page]: http://github.com/git-quick-stats/git-quick-stats/blob/master/.github/CONTRIBUTING.md +[landing page]: https://git-quick-stats.sh +[LICENSE]: https://github.com/git-quick-stats/git-quick-stats/blob/master/LICENSE + +## Contributors + +This project exists thanks to all the people who contribute. + +[![contributors](https://opencollective.com/git-quick-stats/contributors.svg?width=890&button=false)](https://github.com/git-quick-stats/git-quick-stats/graphs/contributors) + +### Backers + +Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/git-quick-stats#backer)] + +[![backers](https://opencollective.com/git-quick-stats/backers.svg?width=890)](https://opencollective.com/git-quick-stats#backers) + +### Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/git-quick-stats#sponsor)] + +[![sponsor0](https://opencollective.com/git-quick-stats/sponsor/0/avatar.svg?v=1)](https://opencollective.com/git-quick-stats/sponsor/0/website) +[![sponsor1](https://opencollective.com/git-quick-stats/sponsor/1/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/1/website) +[![sponsor2](https://opencollective.com/git-quick-stats/sponsor/2/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/2/website) +[![sponsor3](https://opencollective.com/git-quick-stats/sponsor/3/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/3/website) +[![sponsor4](https://opencollective.com/git-quick-stats/sponsor/4/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/4/website) +[![sponsor5](https://opencollective.com/git-quick-stats/sponsor/5/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/5/website) +[![sponsor6](https://opencollective.com/git-quick-stats/sponsor/6/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/6/website) +[![sponsor7](https://opencollective.com/git-quick-stats/sponsor/7/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/7/website) +[![sponsor8](https://opencollective.com/git-quick-stats/sponsor/8/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/8/website) +[![sponsor9](https://opencollective.com/git-quick-stats/sponsor/9/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/9/website) diff --git a/git-quick-stats b/git-quick-stats index 33940c6..e5d028c 100755 --- a/git-quick-stats +++ b/git-quick-stats @@ -84,6 +84,14 @@ if [[ ! "$_GIT_SORT_BY" =~ ^(name|commits|insertions|deletions|lines)-(asc|desc) _GIT_SORT_BY="name-asc" fi +# Number of days to display in the heatmap +_commit_days=${_GIT_DAYS:-30} +# If the user has not set a number of days, default to 30 +if ! [[ "$_commit_days" =~ ^[0-9]+$ ]] || (( _commit_days <= 0 )); then + echo "Invalid number of days: $_commit_days. Defaulting to 30." + _commit_days=30 +fi + # Default menu theme # Set the legacy theme by typing "export _MENU_THEME=legacy" _theme="${_MENU_THEME:=default}" @@ -141,6 +149,94 @@ function commitsCalendarByAuthor() { ' } +# DESC: Shows a heatmap of commits per hour of each day for the last 30 days +# ARGS: $author (required) +function commitsHeatmap() { + # number of days to display + DAYS=$_commit_days + + optionPicked "Commit Heatmap for the last $DAYS days" + + color_for_count() { + local n=$1 + if (( n == 0 )); then + echo -e "\e[38;2;255;255;0m" # (255,255,0) + elif (( n < 3 )); then + echo -e "\e[38;2;251;231;0m" # (251,231,0) + elif (( n < 6 )); then + echo -e "\e[38;2;247;209;0m" # (247,209,0) + elif (( n < 10 )); then + echo -e "\e[38;2;243;189;0m" # (243,189,0) + elif (( n < 20 )); then + echo -e "\e[38;2;238;170;0m" # (238,170,0) + elif (( n < 50 )); then + echo -e "\e[38;2;232;143;0m" # (232,143,0) + elif (( n < 100 )); then + echo -e "\e[38;2;225;120;0m" # (225,120,0) + elif (( n < 200 )); then + echo -e "\e[38;2;218;99;0m" # (218,99,0) + else + echo -e "\e[38;2;211;81;0m" # (211,81,0) + fi + } + + printf "Day | Date-Hours |" + for h in {0..23}; do + printf " %2d" "$h" + done + echo + echo "------------------------------------------------------------------------------------------" + + for i in $(seq $((DAYS-1)) -1 0); do + day=$(date -d "-$i days" +"%Y-%m-%d") + if [[ $(date -d "$day" +%u) -gt 5 ]]; then + printf "\e[1;30m" + else + printf "\e[0m" + fi + + dayName=$(date -d "$day" +%a) + printf "%s | %s |" "$dayName" "$day" + + declare -a commits_per_hour + for h in {0..23}; do + commits_per_hour[$h]=0 + done + + IFS=$'\n' commits_per_hour=($( + git log --since="$day 00:00" --until="$day 23:59" --pretty=format:"%ci" 2>/dev/null | + awk '{split($2, t, ":"); h = t[1]+0; c[h]++} END {for(i=0;i<24;i++) print c[i]+0}' + )) + unset IFS + + for h in {0..23}; do + count=${commits_per_hour[$h]} + color=$(color_for_count "$count") + if (( count == 0 )); then + printf " \e[90m.\e[0m " + else + printf "%b █ \e[0m" "$color" + fi + done + echo + done + echo "------------------------------------------------------------------------------------------" + + # Color legend with colored first character + echo -e "\nLegend:" + echo -e " \e[38;2;255;255;0m█\e[0m 1-3 commits" + echo -e " \e[38;2;251;231;0m█\e[0m 4-6 commits" + echo -e " \e[38;2;247;209;0m█\e[0m 7-10 commits" + echo -e " \e[38;2;243;189;0m█\e[0m 11-20 commits" + echo -e " \e[38;2;238;170;0m█\e[0m 21-50 commits" + echo -e " \e[38;2;232;143;0m█\e[0m 51-100 commits" + echo -e " \e[38;2;225;120;0m█\e[0m 101-200 commits" + echo -e " \e[38;2;218;99;0m█\e[0m 201-500 commits" + echo -e " \e[38;2;211;81;0m█\e[0m 500+ commits" + echo -e " \e[90m.\e[0m = no commits" + echo +} + ################################################################################ # HELPER AND MENU FUNCTIONS @@ -256,6 +352,12 @@ LIST OPTIONS -Z, --commits-by-author-by-timezone displays a list of commits per timezone by author +CALENDAR OPTIONS + -k, --commits-calendar-by-author + shows a calendar heatmap of commits per day-of-week per month for a given author + -H, --commits-heatmap + shows a heatmap of commits per day-of-week per month for the last 30 days + SUGGEST OPTIONS -r, --suggest-reviewers show the best people to contact to review code @@ -283,7 +385,9 @@ ADDITIONAL USAGE You can set _GIT_IGNORE_AUTHORS to filter out specific authors ex: export _GIT_IGNORE_AUTHORS=\"(author1|author2)\" You can sort contribution stats by field \"name\", \"commits\", \"insertions\", \"deletions\", or \"lines\" - total lines changed and order - \"asc\", \"desc\" - ex: export _GIT_SORT_BY=\"name-asc\"" + ex: export _GIT_SORT_BY=\"name-asc\" + You can set _GIT_DAYS to set the number of days for the heatmap + ex: export _GIT_DAYS=30" } ################################################################################ @@ -357,6 +461,7 @@ function showMenu() { printf %b "${NUMS} 22)${TEXT} Code reviewers (based on git history)\\n" printf %b "\\n${TITLES} Calendar:\\n" printf %b "${NUMS} 23)${TEXT} Activity calendar by author\\n" + printf %b "${NUMS} 24)${TEXT} Activity heatmap for the last $_commit_days days\\n" printf %b "\\n${HELP_TXT}Please enter a menu option or ${EXIT_TXT}press Enter to exit.\\n" printf %b "${TEXT}> ${NORMAL}" read -r opt @@ -1275,13 +1380,14 @@ if [[ "$#" -eq 1 ]]; then read -r -p "Which author? " author done commitsByTimezone "${author}";; - # ACTIVITY OPTIONS + # CALENDAR OPTIONS -k|--commits-calendar-by-author) author="${_GIT_AUTHOR:-}" while [[ -z "${author}" ]]; do read -r -p "Which author? " author done commitsCalendarByAuthor "${author}";; + -H|--commits-heatmap) commitsHeatmap;; # SUGGEST OPTIONS -r|--suggest-reviewers) suggestReviewers;; -h|-\?|--help) usage;; @@ -1374,6 +1480,7 @@ if [[ "$#" -eq 0 ]]; then read -r -p "Which author? " author done commitsCalendarByAuthor "${author}"; showMenu;; + 24) commitsHeatmap; showMenu;; q|"\n") exit;; *) clear; optionPicked "Pick an option from the menu"; showMenu;; esac diff --git a/git-quick-stats.1 b/git-quick-stats.1 index 39b071c..ae39cb4 100644 --- a/git-quick-stats.1 +++ b/git-quick-stats.1 @@ -1,213 +1,206 @@ -.TH git-quick-stats "1" "June 2025" "git-quick-stats" "User Commands" -.SH NAME -.B git\-quick\-stats -\- Simple and efficient way to access various stats in a git repository. -.SH SYNOPSIS -.PP -For non\-interactive mode: -.B git\-quick\-stats [OPTIONS] -.PP -For interactive mode: -.B git-quick-stats -.PP -.SH DESCRIPTION -.PP -Any git repository contains tons of information about commits, contributors, -and files. Extracting this information is not always trivial, mostly because -of a gadzillion options to a gadzillion git commands. -This program allows you to see detailed information about a git repository. -.PP -.SH GENERATE OPTIONS -.PP -\fB\-T\fR, \fB\-\-detailed\-git\-stats\fR -.IP -give a detailed list of git stats -.HP -.PP -\fB\-R\fR, \fB\-\-git\-stats\-by\-branch\fR -.IP -see detailed list of git stats by branch -.HP -.PP -\fB\-c\fR, \fB\-\-changelogs\fR -.IP -see changelogs -.HP -.PP -\fB\-L\fR, \fB\-\-changelogs\-by\-author\fR -.IP -see changelogs by author -.HP -.PP -\fB\-S\fR, \fB\-\-my\-daily\-stats\fR -.IP -see your current daily stats -.HP -.PP -\fB\-V\fR, \fB\-\-csv\-output\-by\-branch\fR -.IP -output daily stats by branch in CSV format -.HP -.PP -\fB\-j\fR, \fB\-\-json\-output\fR -.IP -save git log as a JSON formatted file to a specified area -.HP -.SH LIST OPTIONS -.PP -\fB\-b\fR, \fB\-\-branch\-tree\fR -.IP -show an ASCII graph of the git repo branch history -.HP -.PP -\fB\-D\fR, \fB\-\-branches\-by\-date\fR -.IP -show branches by date -.HP -.PP -\fB\-C\fR, \fB\-\-contributors\fR -.IP -see a list of everyone who contributed to the repo -.HP -.PP -\fB\-n\fR, \fB\-\-new\-contributors\fR -.IP -list everyone who made their first contribution since a specified date -.HP -.PP -\fB\-a\fR, \fB\-\-commits\-per\-author\fR -.IP -displays a list of commits per author -.HP -.PP -\fB\-d\fR, \fB\-\-commits\-per\-day\fR -.IP -displays a list of commits per day -.HP -.PP -\fB\-m\fR, \fB\-\-commits\-by\-month\fR -.IP -displays a list of commits per month -.HP -.PP -\fB\-Y\fR, \fB\-\-commits\-by\-year\fR -.IP -displays a list of commits per year -.HP -.PP -\fB\-w\fR, \fB\-\-commits\-by\-weekday\fR -.IP -displays a list of commits per weekday -.HP -.PP -\fB\-W\fR, \fB\-\-commits\-by\-author\-by\-weekday\fR -.IP -displays a list of commits per weekday by author -.HP -.PP -\fB\-o\fR, \fB\-\-commits\-by\-hour\fR -.IP -displays a list of commits per hour -.HP -.PP -\fB\-A\fR, \fB\-\-commits\-by\-author\-by\-hour\fR -.IP -displays a list of commits per hour by author -.HP -.PP -\fB\-z\fR, \fB\-\-commits\-by\-timezone\fR -.IP -displays a list of commits per timezone -.HP -.PP -\fB\-Z\fR, \fB\-\-commits\-by\-author\-by\-timezone\fR -.IP -displays a list of commits per timezone by author -.HP -.PP -\fB\-\-activity\-calendar\fR -.IP -displays a calendar-style grid of commit activity per day-of-week and month for a selected author. -.HP -.SH SUGGEST OPTIONS -.PP -\fB\-r\fR, \fB\-\-suggest\-reviewers\fR -.IP -show the best people to contact to review code -.HP -.PP -\fB\-h\fR, \-?, \fB\-\-help\fR -.IP -display this help text in the terminal -.PP -.SH ADDITIONAL USAGE -You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log, example: -.PP -.B export _GIT_SINCE="2017\-01\-20" -.PP -You can set _GIT_LIMIT for limited output log, example: -.PP -.B export _GIT_LIMIT=20 -.PP -You can set _GIT_LOG_OPTIONS for git log options, example: -.PP -.B export _GIT_LOG_OPTIONS="--ignore-all-space --ignore-blank-lines" -.PP -You can exclude directories or files from the stats by using pathspec, example: -.PP -.B export _GIT_PATHSPEC=':!pattern' -.PP -You can set _GIT_MERGE_VIEW to show merge commits with normal commits, example: -.PP -.B export _GIT_MERGE_VIEW="enable" -.PP -You can also set _GIT_MERGE_VIEW to only show merge commits, example: -.PP -.B export _GIT_MERGE_VIEW="exclusive" -.PP -You can sort contribution stats by field "name", "commits", "insertions", "deletions", or "lines" (total lines changed) and order ("asc", "desc"). e.g.: "commits-desc" -.PP -.B export _GIT_SORT_BY="name-asc" -.PP -You can change to the legacy color scheme by toggling the variable "_MENU_THEME" between "default" and "legacy". You can completely disable the color theme by setting the "_MENU_THEME" variable to "none", example: -.PP -.B export _MENU_THEME=legacy -.PP -or -.B export _MENU_THEME=none -.PP -You can set _GIT_BRANCH to set the branch of the stats, example: -.PP -.B export _GIT_BRANCH="master" -.PP -.SH Calendar activity output -.PP -\fBactivity-calendar\fR outputs a visual grid of commit activity for a selected author, grouped by day-of-week (rows: Mon..Sun) and month (columns: Jan..Dec). Each cell is 3 characters wide, separated by one space. -.PP -Sample output: -.PP -.nf - Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec -Mon ▓▓▓ ░░░ ▒▒▒ ░░░ ░░░ ▒▒▒ ▓▓▓ ░░░ ░░░ ▓▓▓ ▒▒▒ ▒▒▒ -Tue ▒▒▒ ░░░ ▒▒▒ ░░░ ▒▒▒ ░░░ ▒▒▒ ▓▓▓ ▒▒▒ ░░░ ░░░ ░░░ -Wed ░░░ ▓▓▓ ░░░ ▓▓▓ ▒▒▒ ░░░ ░░░ ▒▒▒ ░░░ ░░░ ▓▓▓ ░░░ -Thu ░░░ ▒▒▒ ░░░ ░░░ ▒▒▒ ░░░ ▓▓▓ ▒▒▒ ▒▒▒ ░░░ ░░░ ▒▒▒ -Fri ▒▒▒ ░░░ ▒▒▒ ▓▓▓ ░░░ ▓▓▓ ▒▒▒ ░░░ ▒▒▒ ░░░ ▒▒▒ ░░░ -Sat ░░░ ░░░ ▒▒▒ ░░░ ░░░ ░░░ ▒▒▒ ░░░ ▒▒▒ ▓▓▓ ▒▒▒ ░░░ -Sun ▓▓▓ ░░░ ▓▓▓ ░░░ ░░░ ▓▓▓ ░░░ ▒▒▒ ░░░ ░░░ ▓▓▓ ░░░ - -Legend: ... = 0 ░░░ = 1–2 ▒▒▒ = 3–5 ▓▓▓ = 6+ commits -.PP -You can set _GIT_IGNORE_AUTHORS to filter out specific authors, example: -.PP -.B export _GIT_IGNORE_AUTHORS="(author@examle.com|username)" -. -.fi - -.PP -.SH SEE ALSO -.BR git (1) -.PP -Project homepage: -.UR https://github.com/git-quick-stats/git-quick-stats +.TH git-quick-stats "1" "June 2025" "git-quick-stats" "User Commands" +.SH NAME +.B git\-quick\-stats +\- Simple and efficient way to access various stats in a git repository. +.SH SYNOPSIS +.PP +For non\-interactive mode: +.B git\-quick\-stats [OPTIONS] +.PP +For interactive mode: +.B git-quick-stats +.PP +.SH DESCRIPTION +.PP +Any git repository contains tons of information about commits, contributors, +and files. Extracting this information is not always trivial, mostly because +of a gadzillion options to a gadzillion git commands. +This program allows you to see detailed information about a git repository. +.PP +.SH GENERATE OPTIONS +.PP +\fB\-h\fR, \-?, \fB\-\-help\fR +.IP +display this help text in the terminal +.PP +\fB\-T\fR, \fB\-\-detailed\-git\-stats\fR +.IP +give a detailed list of git stats +.HP +.PP +\fB\-R\fR, \fB\-\-git\-stats\-by\-branch\fR +.IP +see detailed list of git stats by branch +.HP +.PP +\fB\-c\fR, \fB\-\-changelogs\fR +.IP +see changelogs +.HP +.PP +\fB\-L\fR, \fB\-\-changelogs\-by\-author\fR +.IP +see changelogs by author +.HP +.PP +\fB\-S\fR, \fB\-\-my\-daily\-stats\fR +.IP +see your current daily stats +.HP +.PP +\fB\-V\fR, \fB\-\-csv\-output\-by\-branch\fR +.IP +output daily stats by branch in CSV format +.HP +.PP +\fB\-j\fR, \fB\-\-json\-output\fR +.IP +save git log as a JSON formatted file to a specified area +.HP +.SH LIST OPTIONS +.PP +\fB\-b\fR, \fB\-\-branch\-tree\fR +.IP +show an ASCII graph of the git repo branch history +.HP +.PP +\fB\-D\fR, \fB\-\-branches\-by\-date\fR +.IP +show branches by date +.HP +.PP +\fB\-C\fR, \fB\-\-contributors\fR +.IP +see a list of everyone who contributed to the repo +.HP +.PP +\fB\-n\fR, \fB\-\-new\-contributors\fR +.IP +list everyone who made their first contribution since a specified date +.HP +.PP +\fB\-a\fR, \fB\-\-commits\-per\-author\fR +.IP +displays a list of commits per author +.HP +.PP +\fB\-d\fR, \fB\-\-commits\-per\-day\fR +.IP +displays a list of commits per day +.HP +.PP +\fB\-m\fR, \fB\-\-commits\-by\-month\fR +.IP +displays a list of commits per month +.HP +.PP +\fB\-Y\fR, \fB\-\-commits\-by\-year\fR +.IP +displays a list of commits per year +.HP +.PP +\fB\-w\fR, \fB\-\-commits\-by\-weekday\fR +.IP +displays a list of commits per weekday +.HP +.PP +\fB\-W\fR, \fB\-\-commits\-by\-author\-by\-weekday\fR +.IP +displays a list of commits per weekday by author +.HP +.PP +\fB\-o\fR, \fB\-\-commits\-by\-hour\fR +.IP +displays a list of commits per hour +.HP +.PP +\fB\-A\fR, \fB\-\-commits\-by\-author\-by\-hour\fR +.IP +displays a list of commits per hour by author +.HP +.PP +\fB\-z\fR, \fB\-\-commits\-by\-timezone\fR +.IP +displays a list of commits per timezone +.HP +.PP +\fB\-Z\fR, \fB\-\-commits\-by\-author\-by\-timezone\fR +.IP +displays a list of commits per timezone by author +.HP +.PP +\fB\-\-activity\-calendar\fR +.IP +displays a calendar-style grid of commit activity per day-of-week and month for a selected author. +.HP +.SH SUGGEST OPTIONS +.PP +\fB\-r\fR, \fB\-\-suggest\-reviewers\fR +.IP +show the best people to contact to review code +.HP +.PP +.SH CALENDAR OPTIONS +.PP +\fB\-k\fR, \fB\-\-commits\-calendar\-by\-author\fR outputs a visual grid of commit activity for a selected author, grouped by day-of-week (rows: Mon..Sun) and month (columns: Jan..Dec). Each cell is 3 characters wide, separated by one space. +.PP +.PP +\fB\-H\fR, \fB\-\-commits\-heatmap\fR shows a heatmap of commits per day per hour for the last 30 days +.PP +.SH ADDITIONAL USAGE +You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log, example: +.PP +.B export _GIT_SINCE="2017\-01\-20" +.PP +You can set _GIT_LIMIT for limited output log, example: +.PP +.B export _GIT_LIMIT=20 +.PP +You can set _GIT_LOG_OPTIONS for git log options, example: +.PP +.B export _GIT_LOG_OPTIONS="--ignore-all-space --ignore-blank-lines" +.PP +You can exclude directories or files from the stats by using pathspec, example: +.PP +.B export _GIT_PATHSPEC=':!pattern' +.PP +You can set _GIT_MERGE_VIEW to show merge commits with normal commits, example: +.PP +.B export _GIT_MERGE_VIEW="enable" +.PP +You can also set _GIT_MERGE_VIEW to only show merge commits, example: +.PP +.B export _GIT_MERGE_VIEW="exclusive" +.PP +You can sort contribution stats by field "name", "commits", "insertions", "deletions", or "lines" (total lines changed) and order ("asc", "desc"). e.g.: "commits-desc" +.PP +.B export _GIT_SORT_BY="name-asc" +.PP +You can change to the legacy color scheme by toggling the variable "_MENU_THEME" between "default" and "legacy". You can completely disable the color theme by setting the "_MENU_THEME" variable to "none", example: +.PP +.B export _MENU_THEME=legacy +.PP +or +.B export _MENU_THEME=none +.PP +You can set _GIT_BRANCH to set the branch of the stats, example: +.PP +.B export _GIT_BRANCH="master" +.PP +You can set _GIT_IGNORE_AUTHORS to filter out specific authors, example: +.PP +.B export _GIT_IGNORE_AUTHORS="(author@examle.com|username)" +.PP +You can set _GIT_DAYS to set the number of days for the heatmap, example: +.PP +.B export _GIT_DAYS=30" +. +.fi + +.PP +.SH SEE ALSO +.BR git (1) +.PP +Project homepage: +.UR https://github.com/git-quick-stats/git-quick-stats .UE \ No newline at end of file diff --git a/tests/commands_test.sh b/tests/commands_test.sh index ca3343c..47dda89 100755 --- a/tests/commands_test.sh +++ b/tests/commands_test.sh @@ -73,6 +73,12 @@ LIST OPTIONS -Z, --commits-by-author-by-timezone displays a list of commits per timezone by author +CALENDAR OPTIONS + -k, --commits-calendar-by-author + shows a calendar heatmap of commits per day-of-week per month for a given author + -H, --commits-heatmap + shows a heatmap of commits per day-of-week per month for the last 30 days + SUGGEST OPTIONS -r, --suggest-reviewers show the best people to contact to review code @@ -100,7 +106,9 @@ ADDITIONAL USAGE You can set _GIT_IGNORE_AUTHORS to filter out specific authors ex: export _GIT_IGNORE_AUTHORS=\"(author1|author2)\" You can sort contribution stats by field \"name\", \"commits\", \"insertions\", \"deletions\", or \"lines\" - total lines changed and order - \"asc\", \"desc\" - ex: export _GIT_SORT_BY=\"name-asc\"" + ex: export _GIT_SORT_BY=\"name-asc\" + You can set _GIT_DAYS to set the number of days for the heatmap + ex: export _GIT_DAYS=30" assert_raises "$src fail" 1