Compare commits

..

No commits in common. "master" and "2.6.2" have entirely different histories.

6 changed files with 729 additions and 1169 deletions

View file

@ -1,25 +0,0 @@
cff-version: 1.2.0
title: Git Quick Stats
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- name-particle: tomice
- name-particle: arzzen
identifiers:
- type: url
value: "https://github.com/git-quick-stats"
description: >-
Simple and efficient way to access various statistics
in a git repository
repository-code: "https://github.com/git-quick-stats/git-quick-stats"
url: "https://git-quick-stats.sh/"
abstract: >-
Git-quick-stats is a simple and efficient way to access
various statistics in a git repository.
keywords:
- git
- stats
license: MIT
version: 2.6.2

View file

@ -4,7 +4,7 @@ FROM alpine
COPY . /app COPY . /app
# Install required packages & build git-quick-stats # Install required packages & build git-quick-stats
RUN apk add --no-cache bash git make ncurses coreutils util-linux \ RUN apk add --no-cache bash git make ncurses util-linux \
&& cd /app \ && cd /app \
&& make install \ && make install \
&& rm -rf /app \ && rm -rf /app \

853
README.md
View file

@ -1,433 +1,420 @@
# 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) # 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) [![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. > `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 :). > 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) ![mainImageScreenshot](https://github.com/user-attachments/assets/7d8637a4-5a67-49f6-8724-ca7548b987c6)
## Table of Contents
## Table of Contents
[**Screenshots**](#screenshots)
[**Screenshots**](#screenshots)
[**Usage**](#usage)
[**Usage**](#usage)
- [**Interactive**](#interactive)
- [**Non-interactive**](#non-interactive) - [**Interactive**](#interactive)
- [**Command-line arguments**](#command-line-arguments) - [**Non-interactive**](#non-interactive)
- [**Git log since and until**](#git-log-since-and-until) - [**Command-line arguments**](#command-line-arguments)
- [**Git log limit**](#git-log-limit) - [**Git log since and until**](#git-log-since-and-until)
- [**Git log options**](#git-log-options) - [**Git log limit**](#git-log-limit)
- [**Git pathspec**](#git-pathspec) - [**Git log options**](#git-log-options)
- [**Git merge view strategy**](#git-merge-view-strategy) - [**Git pathspec**](#git-pathspec)
- [**Color themes**](#color-themes) - [**Git merge view strategy**](#git-merge-view-strategy)
- [**Color themes**](#color-themes)
[**Installation**](#installation)
[**Installation**](#installation)
- [**UNIX and Linux**](#unix-and-linux)
- [**macOS**](#macos-homebrew) - [**UNIX and Linux**](#unix-and-linux)
- [**Windows**](#windows) - [**macOS**](#macos-homebrew)
- [**Docker**](#docker) - [**Windows**](#windows)
- [**Docker**](#docker)
[**System requirements**](#system-requirements)
[**System requirements**](#system-requirements)
- [**Dependencies**](#dependencies)
- [**Dependencies**](#dependencies)
[**FAQ**](#faq)
[**FAQ**](#faq)
[**Contribution**](#contribution)
[**Contribution**](#contribution)
- [**Code reviews**](#code-reviews)
- [**Some tips for good pull requests**](#some-tips-for-good-pull-requests) - [**Code reviews**](#code-reviews)
- [**Formatting**](#formatting) - [**Some tips for good pull requests**](#some-tips-for-good-pull-requests)
- [**Formatting**](#formatting)
[**Tests**](#tests)
[**Tests**](#tests)
[**Licensing**](#licensing)
[**Licensing**](#licensing)
[**Contributors**](#contributors)
[**Contributors**](#contributors)
- [**Backers**](#backers)
- [**Sponsors**](#sponsors) - [**Backers**](#backers)
- [**Sponsors**](#sponsors)
## Screenshots
## Screenshots
![commitsByWeekdayScreenshot](https://github.com/user-attachments/assets/3496d245-6385-47d1-878a-726e79100eb1)
![commitsByWeekdayScreenshot](https://github.com/user-attachments/assets/3496d245-6385-47d1-878a-726e79100eb1)
![commitsByHourScreenshot](https://github.com/user-attachments/assets/9f1d69d9-46e0-411d-a5ed-905ffdfb887a)
![commitsByHourScreenshot](https://github.com/user-attachments/assets/9f1d69d9-46e0-411d-a5ed-905ffdfb887a)
![commitActivityScreenshot](https://github.com/user-attachments/assets/693fff31-65c7-4b9f-a011-6114a2d10a26)
![commitActivityScreenshot](https://github.com/user-attachments/assets/693fff31-65c7-4b9f-a011-6114a2d10a26)
## Usage
### Interactive ## Usage
`git-quick-stats` has a built-in interactive menu that can be executed as such: ### Interactive
```bash `git-quick-stats` has a built-in interactive menu that can be executed as such:
git-quick-stats
``` ```bash
git-quick-stats
Or ```
```bash Or
git quick-stats
``` ```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: ### Non-interactive
```bash For those who prefer to utilize command-line options, `git-quick-stats` also has a non-interactive mode supporting both short and long options:
git-quick-stats <optional-command-to-execute-directly>
``` ```bash
git-quick-stats <optional-command-to-execute-directly>
Or ```
```bash Or
git quick-stats <optional-command-to-execute-directly>
``` ```bash
git quick-stats <optional-command-to-execute-directly>
### Command-line arguments ```
Possible arguments in short and long form: ### Command-line arguments
```bash Possible arguments in short and long form:
GENERATE OPTIONS
-T, --detailed-git-stats ```bash
give a detailed list of git stats GENERATE OPTIONS
-R, --git-stats-by-branch -T, --detailed-git-stats
see detailed list of git stats by branch give a detailed list of git stats
-c, --changelogs -R, --git-stats-by-branch
see changelogs see detailed list of git stats by branch
-L, --changelogs-by-author -c, --changelogs
see changelogs by author see changelogs
-S, --my-daily-stats -L, --changelogs-by-author
see your current daily stats see changelogs by author
-V, --csv-output-by-branch -S, --my-daily-stats
output daily stats by branch in CSV format see your current daily stats
-j, --json-output -V, --csv-output-by-branch
save git log as a JSON formatted file to a specified area output daily stats by branch in CSV format
-j, --json-output
LIST OPTIONS save git log as a JSON formatted file to a specified area
-b, --branch-tree
show an ASCII graph of the git repo branch history LIST OPTIONS
-D, --branches-by-date -b, --branch-tree
show branches by date show an ASCII graph of the git repo branch history
-C, --contributors -D, --branches-by-date
see a list of everyone who contributed to the repo show branches by date
-n, --new-contributors -C, --contributors
list everyone who made their first contribution since a specified date see a list of everyone who contributed to the repo
-N, --new-contributors-since-tag -n, --new-contributors
list everyone who made their first contribution since a specified git tag list everyone who made their first contribution since a specified date
-a, --commits-per-author -a, --commits-per-author
displays a list of commits per author displays a list of commits per author
-d, --commits-per-day -d, --commits-per-day
displays a list of commits per day displays a list of commits per day
-m, --commits-by-month -Y, --commits-by-year
displays a list of commits per month displays a list of commits per year
-Y, --commits-by-year -m, --commits-by-month
displays a list of commits per year displays a list of commits per month
-w, --commits-by-weekday -w, --commits-by-weekday
displays a list of commits per weekday displays a list of commits per weekday
-W, --commits-by-author-by-weekday -W, --commits-by-author-by-weekday
displays a list of commits per weekday by author displays a list of commits per weekday by author
-o, --commits-by-hour -o, --commits-by-hour
displays a list of commits per hour displays a list of commits per hour
-A, --commits-by-author-by-hour -A, --commits-by-author-by-hour
displays a list of commits per hour by author displays a list of commits per hour by author
-z, --commits-by-timezone -z, --commits-by-timezone
displays a list of commits per timezone displays a list of commits per timezone
-Z, --commits-by-author-by-timezone -Z, --commits-by-author-by-timezone
displays a list of commits per timezone by author displays a list of commits per timezone by author
CALENDAR OPTIONS SUGGEST OPTIONS
-k, --commits-calendar-by-author -r, --suggest-reviewers
shows a calendar heatmap of commits per day-of-week per month for a given author show the best people to contact to review code
-H, --commits-heatmap -h, -?, --help
shows a heatmap of commits per day-of-week per month for the last 30 days display this help text in the terminal
```
SUGGEST OPTIONS
-r, --suggest-reviewers ### Git log since and until
show the best people to contact to review code
-h, -?, --help 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.
display this help text in the terminal
``` ```bash
export _GIT_SINCE="2017-01-20"
### Git log since and until export _GIT_UNTIL="2017-01-22"
```
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.
Once set, run `git quick-stats` as normal. Note that this affects all stats that parse the git log history until unset.
```bash
export _GIT_SINCE="2017-01-20" ### Git log limit
export _GIT_UNTIL="2017-01-22"
``` You can set variable `_GIT_LIMIT` for limited output. It will affect the "changelogs" and "branch tree" options. The default limit is `10`.
Once set, run `git quick-stats` as normal. Note that this affects all stats that parse the git log history until unset. ```bash
export _GIT_LIMIT=20
### 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`. ### Git log options
```bash You can set `_GIT_LOG_OPTIONS` for [git log options](https://git-scm.com/docs/git-log#_options):
export _GIT_LIMIT=20
``` ```bash
export _GIT_LOG_OPTIONS="--ignore-all-space --ignore-blank-lines"
### Git tag ```
You can set `_GIT_TAG` to define the default tag used by the "new contributors since tag" option. ### Git pathspec
```bash You can exclude a directory from the stats by using [pathspec](https://git-scm.com/docs/gitglossary#gitglossary-aiddefpathspecapathspec)
export _GIT_TAG="foo"
``` ```bash
export _GIT_PATHSPEC=':!directory'
### Git log options ```
You can set `_GIT_LOG_OPTIONS` for [git log options](https://git-scm.com/docs/git-log#_options): You can also exclude files from the stats. Note that it works with any alphanumeric, glob, or regex that git respects.
```bash ```bash
export _GIT_LOG_OPTIONS="--ignore-all-space --ignore-blank-lines" export _GIT_PATHSPEC=':!package-lock.json'
``` ```
### Git pathspec ### Git merge view strategy
You can exclude a directory from the stats by using [pathspec](https://git-scm.com/docs/gitglossary#gitglossary-aiddefpathspecapathspec) 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 ```bash
export _GIT_PATHSPEC=':!directory' export _GIT_MERGE_VIEW="enable"
``` export _GIT_MERGE_VIEW="exclusive"
```
You can also exclude files from the stats. Note that it works with any alphanumeric, glob, or regex that git respects.
### Git branch
```bash
export _GIT_PATHSPEC=':!package-lock.json' 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
### Git merge view strategy export _GIT_BRANCH="master"
```
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.
### Ignore authors
```bash
export _GIT_MERGE_VIEW="enable" 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.
export _GIT_MERGE_VIEW="exclusive"
``` ```bash
export _GIT_IGNORE_AUTHORS="(author@examle.com|username)"
### 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`. ### Sorting contribution stats
```bash You can sort contribution stats by field `name`, `commits`, `insertions`, `deletions`, or `lines` (total lines changed) and order (`asc`, `desc`). e.g.: `commits-desc`
export _GIT_BRANCH="master"
``` ```bash
export _GIT_SORT_BY="name-asc"
### 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. ### Color themes
```bash You can change to the legacy color scheme by toggling the variable `_MENU_THEME` between `default` and `legacy`.
export _GIT_IGNORE_AUTHORS="(author@examle.com|username)" You can completely disable the color theme by setting the `_MENU_THEME` variable to `none`.
```
```bash
### Sorting contribution stats export _MENU_THEME="legacy"
# or
You can sort contribution stats by field `name`, `commits`, `insertions`, `deletions`, or `lines` (total lines changed) and order (`asc`, `desc`). e.g.: `commits-desc` export _MENU_THEME="none"
```
```bash
export _GIT_SORT_BY="name-asc" ![legacyThemeScreenshot](https://github.com/user-attachments/assets/3b319c1a-827f-47b8-bbfa-b8b59a39deef)
```
## Installation
### Commit days
### Debian and Ubuntu
You can set \_GIT_DAYS to set the number of days for the heatmap
If you are on at least Debian Bullseye or Ubuntu Focal you can use apt for installation:
```bash
export _GIT_DAYS=30 ```bash
``` apt install git-quick-stats
```
### Color themes
### UNIX and Linux
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
git clone https://github.com/git-quick-stats/git-quick-stats.git && cd git-quick-stats
```bash sudo make install
export _MENU_THEME="legacy" ```
# or
export _MENU_THEME="none" For uninstalling, open up the cloned directory and run
```
```bash
![legacyThemeScreenshot](https://github.com/user-attachments/assets/3b319c1a-827f-47b8-bbfa-b8b59a39deef) sudo make uninstall
```
## Installation
For update/reinstall
### Debian and Ubuntu
```bash
If you are on at least Debian Bullseye or Ubuntu Focal you can use apt for installation: sudo make reinstall
```
```bash
apt install git-quick-stats ### macOS (homebrew)
```
macOS requires GNU coreutils to be installed and for the non "g" aliased
### UNIX and Linux 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
git clone https://github.com/git-quick-stats/git-quick-stats.git && cd git-quick-stats ```bash
sudo make install brew install coreutils
``` export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
```
For uninstalling, open up the cloned directory and run
From there, you can install via Homebrew as follows:
```bash
sudo make uninstall ```bash
``` brew install git-quick-stats
```
For update/reinstall
Or you can follow the UNIX and Linux instructions if you wish.
```bash
sudo make reinstall 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
### macOS (homebrew) based on the shell of your choice.
`git-quick-stats` requires GNU `date`. On macOS, install GNU coreutils: ### Windows
```bash If you are installing with Cygwin, use these scripts:
brew install coreutils
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH" - [installer](https://gist.github.com/arzzen/35e09866dfdadf2108b2420045739245)
``` - [uninstaller](https://gist.github.com/arzzen/21c660014d0663b6c5710014714779d6)
The script auto-detects GNU date as either `date` or `gdate`, so exporting If you are wishing to use this with WSL, follow the UNIX and Linux instructions.
`gnubin` is optional for this project.
### Docker
From there, you can install via Homebrew as follows:
You can use the Docker image provided:
```bash
brew install git-quick-stats - 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)
Or you can follow the UNIX and Linux instructions if you wish.
## System requirements
If you would like to default to using GNU coreutils system-wide, add
`export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"` to your - An OS with a Bash shell
applicable `~/.bash_profile`, `~/.zprofile`, or other relevant profile based - Tools we use:
on the shell of your choice.
```bash
### FreeBSD awk
basename
`git-quick-stats` requires GNU `date`. On FreeBSD, install GNU coreutils: cat
column
```bash date
pkg install coreutils echo
``` git
grep
FreeBSD provides GNU date as `gdate`, and the script auto-detects it. head
printf
### Windows seq
sort
If you are installing with Cygwin, use these scripts: tput
tr
- [installer](https://gist.github.com/arzzen/35e09866dfdadf2108b2420045739245) uniq
- [uninstaller](https://gist.github.com/arzzen/21c660014d0663b6c5710014714779d6) ```
If you are wishing to use this with WSL, follow the UNIX and Linux instructions. ### Dependencies
### Docker - [`bsdextrautils`](https://packages.debian.org/sid/bsdextrautils) `apt install bsdextrautils`
- [`coreutils`](https://packages.debian.org/sid/coreutils) `apt install coreutils`
You can use the Docker image provided: - [`gawk`](https://packages.debian.org/sid/gawk) `apt install gawk`
- [`grep`](https://packages.debian.org/sid/grep) `apt install grep`
- Build: `docker build -t arzzen/git-quick-stats .` - [`ncurses-bin`](https://packages.debian.org/sid/ncurses-bin) `apt install ncurses-bin`
- 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) ## FAQ
## System requirements _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`
- An OS with a Bash shell _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.
- GNU `date` available as either `date` or `gdate`
- Tools we use: _Q:_ How they could be used in a project with many git projects and statistics would show a summary of all git projects?
```bash _A:_ If you want to include submodule logs, you can try using the following: `export _GIT_LOG_OPTIONS="-p --submodule=log"`
awk (more info about [git log --submodule](https://git-scm.com/docs/git-log#Documentation/git-log.txt---submoduleltformatgt))
basename
cat ## Contribution
column
date Want to contribute? Great! First, read this page.
echo
git ### Code reviews
grep
head All submissions, including submissions by project members, require review.</br>
printf We use GitHub pull requests for this purpose.
seq
sort ### Some tips for good pull requests
tput
tr - Use our code </br>
uniq 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:
### Dependencies [here](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message)
and [here](https://www.kernel.org/doc/Documentation/SubmittingPatches).
- [`bsdextrautils`](https://packages.debian.org/sid/bsdextrautils) `apt install bsdextrautils` - If your PR consists of multiple commits which are successive improvements /
- [`coreutils`](https://packages.debian.org/sid/coreutils) `apt install coreutils` fixes to your first commit, consider squashing them into a single commit
- [`gawk`](https://packages.debian.org/sid/gawk) `apt install gawk` (`git rebase -i`) such that your PR is a single commit on top of the current
- [`grep`](https://packages.debian.org/sid/grep) `apt install grep` HEAD. This make reviewing the code so much easier, and our history more
- [`ncurses-bin`](https://packages.debian.org/sid/ncurses-bin) `apt install ncurses-bin` readable.
## FAQ ### Formatting
_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` This documentation is written using standard [markdown syntax](https://help.github.com/articles/markdown-basics/). Please submit your changes using the same syntax.
_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. ## Tests
_Q:_ How they could be used in a project with many git projects and statistics would show a summary of all git projects? [![codecov](https://codecov.io/gh/arzzen/git-quick-stats/branch/master/graph/badge.svg)](https://codecov.io/gh/arzzen/git-quick-stats)
_A:_ If you want to include submodule logs, you can try using the following: `export _GIT_LOG_OPTIONS="-p --submodule=log"` ```bash
(more info about [git log --submodule](https://git-scm.com/docs/git-log#Documentation/git-log.txt---submoduleltformatgt)) make test
```
## Contribution
## Licensing
Want to contribute? Great! First, read this page.
MIT see [LICENSE][] for the full license text.
### Code reviews
[read this page]: http://github.com/git-quick-stats/git-quick-stats/blob/master/.github/CONTRIBUTING.md
All submissions, including submissions by project members, require review.</br> [landing page]: https://git-quick-stats.sh
We use GitHub pull requests for this purpose. [LICENSE]: https://github.com/git-quick-stats/git-quick-stats/blob/master/LICENSE
### Some tips for good pull requests ## Contributors
- Use our code </br> This project exists thanks to all the people who contribute.
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 [![contributors](https://opencollective.com/git-quick-stats/contributors.svg?width=890&button=false)](https://github.com/git-quick-stats/git-quick-stats/graphs/contributors)
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) ### Backers
and [here](https://www.kernel.org/doc/Documentation/SubmittingPatches).
- If your PR consists of multiple commits which are successive improvements / Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/git-quick-stats#backer)]
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 [![backers](https://opencollective.com/git-quick-stats/backers.svg?width=890)](https://opencollective.com/git-quick-stats#backers)
HEAD. This make reviewing the code so much easier, and our history more
readable. ### Sponsors
### Formatting 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)]
This documentation is written using standard [markdown syntax](https://help.github.com/articles/markdown-basics/). Please submit your changes using the same syntax. [![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)
## Tests [![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)
[![codecov](https://codecov.io/gh/arzzen/git-quick-stats/branch/master/graph/badge.svg)](https://codecov.io/gh/arzzen/git-quick-stats) [![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)
```bash [![sponsor6](https://opencollective.com/git-quick-stats/sponsor/6/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/6/website)
make test [![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)
## 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)

View file

@ -10,33 +10,6 @@
set -o nounset set -o nounset
set -o errexit set -o errexit
# Global color variables using tput setaf
COLOR_NORMAL=$(tput sgr0)
COLOR_CYANL=$(tput setaf 6)
COLOR_BOLD=$(tput bold)
COLOR_RED=$(tput setaf 1)
COLOR_YELLOW=$(tput setaf 3)
COLOR_WHITE=$(tput setaf 7)
COLOR_BRIGHT_YELLOW=$(tput setaf 226)
COLOR_GOLD=$(tput setaf 220)
COLOR_ORANGE=$(tput setaf 214)
COLOR_DARK_ORANGE=$(tput setaf 208)
COLOR_RED_ORANGE=$(tput setaf 202)
COLOR_DARK_RED=$(tput setaf 160)
COLOR_DEEP_RED=$(tput setaf 88)
COLOR_DARKEST_RED=$(tput setaf 52)
COLOR_GRAY=$(tput setaf 240)
COLOR_RESET=$(tput sgr0)
# Detect GNU date command (may be 'gdate' on FreeBSD/macOS with coreutils)
if date --version >/dev/null 2>&1; then
_DATE_CMD="date"
elif gdate --version >/dev/null 2>&1; then
_DATE_CMD="gdate"
else
_DATE_CMD="date"
fi
# Beginning git log date. Respects all git datetime formats # Beginning git log date. Respects all git datetime formats
# If $_GIT_SINCE is never set, look at the repository to find the first date. # If $_GIT_SINCE is never set, look at the repository to find the first date.
# NOTE: previously this put the date at the fixed GIT epoch (May 2005) # NOTE: previously this put the date at the fixed GIT epoch (May 2005)
@ -54,7 +27,7 @@ _until=${_GIT_UNTIL:-}
if [[ -n "${_until}" ]]; then if [[ -n "${_until}" ]]; then
_until="--until=$_until" _until="--until=$_until"
else else
_until="--until=$(LC_TIME=C $_DATE_CMD '+%a, %d %b %Y %H:%M:%S %Z')" _until="--until=$(LC_TIME=C date '+%a, %d %b %Y %H:%M:%S %Z')"
fi fi
# Set files or directories to be excluded in stats # Set files or directories to be excluded in stats
@ -111,17 +84,6 @@ if [[ ! "$_GIT_SORT_BY" =~ ^(name|commits|insertions|deletions|lines)-(asc|desc)
_GIT_SORT_BY="name-asc" _GIT_SORT_BY="name-asc"
fi 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
# Specific git tag
_tag="${_GIT_TAG:-}"
# Default menu theme # Default menu theme
# Set the legacy theme by typing "export _MENU_THEME=legacy" # Set the legacy theme by typing "export _MENU_THEME=legacy"
_theme="${_MENU_THEME:=default}" _theme="${_MENU_THEME:=default}"
@ -140,17 +102,17 @@ function commitsCalendarByAuthor() {
# Gather commit counts # Gather commit counts
git -c log.showSignature=false log --use-mailmap $_merges \ git -c log.showSignature=false log --use-mailmap $_merges \
--date=iso --author="$author" "$_since" "$_until" $_log_options \ --date=iso --author="$author" "$_since" "$_until" $_log_options \
--pretty='%ad' $_pathspec | awk -v date_cmd="$_DATE_CMD" ' --pretty='%ad' $_pathspec | awk '
{ {
split($0, a, " "); split($0, a, " ");
# a[1] = YYYY-MM-DD # a[1] = YYYY-MM-DD
split(a[1], date_fields, "-"); split(a[1], date_fields, "-");
mon = date_fields[2] + 0; mon = date_fields[2] + 0;
cmd = date_cmd " -d \"" a[1] "\" +%u"; cmd = "date -d \"" a[1] "\" +%u";
cmd | getline weekday; cmd | getline weekday;
close(cmd); close(cmd);
# weekday: 1=Mon, ..., 7=Sun # weekday: 1=Mon, ..., 7=Sun
count[weekday * 12 + mon]++; count[weekday][mon]++;
} }
END { END {
# Output matrix # Output matrix
@ -163,7 +125,7 @@ function commitsCalendarByAuthor() {
else if (d==6) printf "Sat "; else if (d==6) printf "Sat ";
else if (d==7) printf "Sun "; else if (d==7) printf "Sun ";
for (m=1; m<=12; m++) { for (m=1; m<=12; m++) {
c = count[d * 12 + m]+0; c = count[d][m]+0;
if (c==0) if (c==0)
out="..."; out="...";
else if (c<=9) else if (c<=9)
@ -179,93 +141,6 @@ function commitsCalendarByAuthor() {
' '
} }
# DESC: Shows a heatmap of commits per hour of each day for the last 30 days
function commitsHeatmap() {
optionPicked "Commit Heatmap for the last $_commit_days days"
color_for_count() {
local n=$1
if (( n == 1 )); then
echo -n "${COLOR_BRIGHT_YELLOW}"
elif (( n < 2 )); then
echo -n "${COLOR_GOLD}"
elif (( n < 3 )); then
echo -n "${COLOR_ORANGE}"
elif (( n < 4 )); then
echo -n "${COLOR_DARK_ORANGE}"
elif (( n < 5 )); then
echo -n "${COLOR_RED_ORANGE}"
elif (( n < 6 )); then
echo -n "${COLOR_RED}"
elif (( n < 8 )); then
echo -n "${COLOR_DARK_RED}"
elif (( n < 10 )); then
echo -n "${COLOR_DEEP_RED}"
else
echo -n "${COLOR_DARKEST_RED}"
fi
}
printf "Day | Date/Hours |"
local h
for h in {0..23}; do
printf " %2d" "$h"
done
echo
echo "------------------------------------------------------------------------------------------"
local i
for i in $(seq $((_commit_days-1)) -1 0); do
local day=$($_DATE_CMD -d "-$i days" +"%Y-%m-%d")
if [[ $($_DATE_CMD -d "$day" +%u) -gt 5 ]]; then
echo -en "${COLOR_GRAY}"
else
echo -en "${COLOR_RESET}"
fi
local dayName=$($_DATE_CMD -d "$day" +%a)
printf "%s | %s |" "$dayName" "$day"
declare -a commits_per_hour
local h
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
local h
for h in {0..23}; do
local count=${commits_per_hour[$h]}
local color=$(color_for_count "$count")
if (( count == 0 )); then
echo -en " ${COLOR_GRAY}.${COLOR_RESET} "
else
echo -en "${color} █ ${COLOR_RESET}"
fi
done
echo
done
echo "------------------------------------------------------------------------------------------"
echo -e "\nLegend:"
echo -e " ${COLOR_BRIGHT_YELLOW}█${COLOR_RESET} 1 commit"
echo -e " ${COLOR_GOLD}█${COLOR_RESET} 2 commits"
echo -e " ${COLOR_ORANGE}█${COLOR_RESET} 3 commits"
echo -e " ${COLOR_DARK_ORANGE}█${COLOR_RESET} 4 commits"
echo -e " ${COLOR_RED_ORANGE}█${COLOR_RESET} 5 commits"
echo -e " ${COLOR_RED}█${COLOR_RESET} 6 commits"
echo -e " ${COLOR_DARK_RED}█${COLOR_RESET} 78 commits"
echo -e " ${COLOR_DEEP_RED}█${COLOR_RESET} 910 commits"
echo -e " ${COLOR_DARKEST_RED}█${COLOR_RESET} 11+ commits"
echo -e " ${COLOR_GRAY}.${COLOR_RESET} = no commits"
echo
}
################################################################################ ################################################################################
# HELPER AND MENU FUNCTIONS # HELPER AND MENU FUNCTIONS
@ -276,7 +151,7 @@ function commitsHeatmap() {
################################################################################ ################################################################################
function checkUtils() { function checkUtils() {
readonly MSG="not found. Please make sure this is installed and in PATH." readonly MSG="not found. Please make sure this is installed and in PATH."
readonly UTILS="awk basename cat column echo git grep head printf seq \ readonly UTILS="awk basename cat column date echo git grep head printf seq \
sort tput tr uniq" sort tput tr uniq"
for u in $UTILS for u in $UTILS
@ -286,13 +161,16 @@ function checkUtils() {
# NOTE: The --version flag is only available in GNU date which is required # NOTE: The --version flag is only available in GNU date which is required
# for how the current date/time strings are used in this shell script. # for how the current date/time strings are used in this shell script.
# On FreeBSD and macOS the system date is BSD date; GNU date may be # To fully support the legacy BSD date found in a default install within
# installed as 'gdate' via coreutils. _DATE_CMD is auto-detected above. # macOS and older distributions of Linux and Unix, a handful of helper
if ! "$_DATE_CMD" --version >/dev/null 2>&1; then # functions can probably be created to handle every case of incompatibility
# between the two. Until that's implemented, it is probably best to warn
# the user that this will not work rather than having it silently bomb out
# during runtime.
if ! date --version >/dev/null 2>&1; then
echo "ERROR: GNU date is required." echo "ERROR: GNU date is required."
echo "On macOS, install it with: brew install coreutils" echo "If you're on macOS, please install it using 'brew install coreutils'."
echo "On FreeBSD, install it with: pkg install coreutils (provides gdate)" echo "Ensure that your PATH is configured to use GNU date as well."
echo "Ensure that GNU date (or gdate) is in your PATH."
echo "See the README.md for further details." echo "See the README.md for further details."
exit 1 exit 1
fi fi
@ -357,8 +235,6 @@ LIST OPTIONS
see a list of everyone who contributed to the repo see a list of everyone who contributed to the repo
-n, --new-contributors -n, --new-contributors
list everyone who made their first contribution since a specified date list everyone who made their first contribution since a specified date
-N, --new-contributors-since-tag
list everyone who made their first contribution since a specified tag
-a, --commits-per-author -a, --commits-per-author
displays a list of commits per author displays a list of commits per author
-d, --commits-per-day -d, --commits-per-day
@ -380,12 +256,6 @@ LIST OPTIONS
-Z, --commits-by-author-by-timezone -Z, --commits-by-author-by-timezone
displays a list of commits per timezone by author 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 SUGGEST OPTIONS
-r, --suggest-reviewers -r, --suggest-reviewers
show the best people to contact to review code show the best people to contact to review code
@ -413,9 +283,7 @@ ADDITIONAL USAGE
You can set _GIT_IGNORE_AUTHORS to filter out specific authors You can set _GIT_IGNORE_AUTHORS to filter out specific authors
ex: export _GIT_IGNORE_AUTHORS=\"(author1|author2)\" 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\" 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"
} }
################################################################################ ################################################################################
@ -425,6 +293,12 @@ ADDITIONAL USAGE
################################################################################ ################################################################################
function showMenu() { function showMenu() {
# These are "global" and can be overriden from users if so desired # These are "global" and can be overriden from users if so desired
NORMAL=$(tput sgr0)
CYAN=$(tput setaf 6)
BOLD=$(tput bold)
RED=$(tput setaf 1)
YELLOW=$(tput setaf 3)
WHITE=$(tput setaf 7)
TITLES="" TITLES=""
TEXT="" TEXT=""
NUMS="" NUMS=""
@ -434,29 +308,29 @@ function showMenu() {
# Adjustable color menu option # Adjustable color menu option
case "${_theme}" in case "${_theme}" in
"legacy" ) "legacy" )
TITLES="${COLOR_BOLD}${COLOR_RED}" TITLES="${BOLD}${RED}"
TEXT="${COLOR_NORMAL}${COLOR_CYANL}" TEXT="${NORMAL}${CYAN}"
NUMS="${COLOR_BOLD}${COLOR_YELLOW}" NUMS="${BOLD}${YELLOW}"
HELP_TXT="${COLOR_NORMAL}${COLOR_YELLOW}" HELP_TXT="${NORMAL}${YELLOW}"
EXIT_TXT="${COLOR_BOLD}${COLOR_RED}" EXIT_TXT="${BOLD}${RED}"
;; ;;
"none" ) "none" )
TITLES="${COLOR_BOLD}" TITLES="${BOLD}"
TEXT="${COLOR_NORMAL}" TEXT="${NORMAL}"
NUMS="${COLOR_BOLD}" NUMS="${BOLD}"
HELP_TXT="${COLOR_NORMAL}" HELP_TXT="${NORMAL}"
EXIT_TXT="${COLOR_BOLD}" EXIT_TXT="${BOLD}"
;; ;;
*) *)
TITLES="${COLOR_BOLD}${COLOR_CYANL}" TITLES="${BOLD}${CYAN}"
TEXT="${COLOR_NORMAL}${COLOR_WHITE}" TEXT="${NORMAL}${WHITE}"
NUMS="${COLOR_NORMAL}${COLOR_BOLD}${COLOR_WHITE}" NUMS="${NORMAL}${BOLD}${WHITE}"
HELP_TXT="${COLOR_NORMAL}${COLOR_CYANL}" HELP_TXT="${NORMAL}${CYAN}"
EXIT_TXT="${COLOR_BOLD}${COLOR_CYANL}" EXIT_TXT="${BOLD}${CYAN}"
;; ;;
esac esac
printf %b "\\n${TITLES} Generate:${COLOR_NORMAL}\\n" printf %b "\\n${TITLES} Generate:${NORMAL}\\n"
printf %b "${NUMS} 1)${TEXT} Contribution stats (by author)\\n" printf %b "${NUMS} 1)${TEXT} Contribution stats (by author)\\n"
printf %b "${NUMS} 2)${TEXT} Contribution stats (by author) on a specific branch\\n" printf %b "${NUMS} 2)${TEXT} Contribution stats (by author) on a specific branch\\n"
printf %b "${NUMS} 3)${TEXT} Git changelogs (last $_limit days)\\n" printf %b "${NUMS} 3)${TEXT} Git changelogs (last $_limit days)\\n"
@ -469,24 +343,22 @@ function showMenu() {
printf %b "${NUMS} 9)${TEXT} All branches (sorted by most recent commit)\\n" printf %b "${NUMS} 9)${TEXT} All branches (sorted by most recent commit)\\n"
printf %b "${NUMS} 10)${TEXT} All contributors (sorted by name)\\n" printf %b "${NUMS} 10)${TEXT} All contributors (sorted by name)\\n"
printf %b "${NUMS} 11)${TEXT} New contributors (sorted by email)\\n" printf %b "${NUMS} 11)${TEXT} New contributors (sorted by email)\\n"
printf %b "${NUMS} 12)${TEXT} New contributors since a tag\\n" printf %b "${NUMS} 12)${TEXT} Git commits per author\\n"
printf %b "${NUMS} 13)${TEXT} Git commits per author\\n" printf %b "${NUMS} 13)${TEXT} Git commits per date\\n"
printf %b "${NUMS} 14)${TEXT} Git commits per date\\n" printf %b "${NUMS} 14)${TEXT} Git commits per month\\n"
printf %b "${NUMS} 15)${TEXT} Git commits per month\\n" printf %b "${NUMS} 15)${TEXT} Git commits per year\\n"
printf %b "${NUMS} 16)${TEXT} Git commits per year\\n" printf %b "${NUMS} 16)${TEXT} Git commits per weekday\\n"
printf %b "${NUMS} 17)${TEXT} Git commits per weekday\\n" printf %b "${NUMS} 17)${TEXT} Git commits per weekday by author\\n"
printf %b "${NUMS} 18)${TEXT} Git commits per weekday by author\\n" printf %b "${NUMS} 18)${TEXT} Git commits per hour\\n"
printf %b "${NUMS} 19)${TEXT} Git commits per hour\\n" printf %b "${NUMS} 19)${TEXT} Git commits per hour by author\\n"
printf %b "${NUMS} 20)${TEXT} Git commits per hour by author\\n" printf %b "${NUMS} 20)${TEXT} Git commits per timezone\\n"
printf %b "${NUMS} 21)${TEXT} Git commits per timezone\\n" printf %b "${NUMS} 21)${TEXT} Git commits per timezone by author\\n"
printf %b "${NUMS} 22)${TEXT} Git commits per timezone by author\\n"
printf %b "\\n${TITLES} Suggest:\\n" printf %b "\\n${TITLES} Suggest:\\n"
printf %b "${NUMS} 23)${TEXT} Code reviewers (based on git history)\\n" printf %b "${NUMS} 22)${TEXT} Code reviewers (based on git history)\\n"
printf %b "\\n${TITLES} Calendar:\\n" printf %b "\\n${TITLES} Calendar:\\n"
printf %b "${NUMS} 24)${TEXT} Activity calendar by author\\n" printf %b "${NUMS} 23)${TEXT} Activity calendar by author\\n"
printf %b "${NUMS} 25)${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 "\\n${HELP_TXT}Please enter a menu option or ${EXIT_TXT}press Enter to exit.\\n"
printf %b "${TEXT}> ${COLOR_NORMAL}" printf %b "${TEXT}> ${NORMAL}"
read -r opt read -r opt
} }
@ -568,8 +440,7 @@ function detailedGitStats() {
sort_command="sort ${sort_flags}" sort_command="sort ${sort_flags}"
# 1. git log -> awk (extract data) -> sort -> awk (format output with graphs) # 1. git log -> awk (extract data) -> sort -> awk (format output with graphs)
# Use --shortstat so merge commits contribute insertion/deletion/file counts. git -c log.showSignature=false log ${_branch} --use-mailmap $_merges --numstat \
git -c log.showSignature=false log ${_branch} --use-mailmap $_merges --shortstat --cc \
--pretty="format:commit %H%nAuthor: %aN <%aE>%nDate: %ad%n%n%w(0,4,4)%B%n" \ --pretty="format:commit %H%nAuthor: %aN <%aE>%nDate: %ad%n%n%w(0,4,4)%B%n" \
"$_since" "$_until" $_log_options $_pathspec | "$_since" "$_until" $_log_options $_pathspec |
LC_ALL=C awk ' LC_ALL=C awk '
@ -583,31 +454,10 @@ function detailedGitStats() {
if (last[author] == "") { last[author] = current_date; } if (last[author] == "") { last[author] = current_date; }
first[author] = current_date; first[author] = current_date;
} }
/file changed|files changed/ { /^[0-9]/ {
files = 0; more[author] += $1;
insertions = 0; less[author] += $2;
deletions = 0; file[author] += 1;
split($0, stats, ",");
for (i in stats) {
value = stats[i];
gsub(/^ +| +$/, "", value);
if (value ~ /file changed|files changed/) {
gsub(/[^0-9]/, "", value);
files = value + 0;
} else if (value ~ /insertion/) {
gsub(/[^0-9]/, "", value);
insertions = value + 0;
} else if (value ~ /deletion/) {
gsub(/[^0-9]/, "", value);
deletions = value + 0;
}
}
more[author] += insertions;
less[author] += deletions;
file[author] += files;
} }
END { END {
for (author in commits) { for (author in commits) {
@ -714,7 +564,7 @@ function changelogs() {
local _author="" local _author=""
local commits="" local commits=""
local author="${1:-}" local author="${1:-}"
local next=$($_DATE_CMD +%F) local next=$(date +%F)
if [[ -z "${author}" ]]; then if [[ -z "${author}" ]]; then
optionPicked "Git changelogs:" optionPicked "Git changelogs:"
@ -754,162 +604,19 @@ function changelogs() {
################################################################################ ################################################################################
function myDailyStats() { function myDailyStats() {
optionPicked "My daily status:" optionPicked "My daily status:"
git diff --shortstat '@{0 day ago}' | sort -nr | tr ',' '\n' | LC_ALL=C awk '
{ args[NR] = $0; }
END {
for (i = 1; i <= NR; ++i) {
printf "\t%s\n", args[i]
}
}'
local -r my_name="$(git config user.name)" echo -e "\t" $(git -c log.showSignature=false log --use-mailmap \
local -r my_email="$(git config user.email)" --author="$(git config user.name)" $_merges \
local -r today_start="$(date "+%Y-%m-%dT00:00:00")" --since=$(date "+%Y-%m-%dT00:00:00") \
local -r today_end="$(date "+%Y-%m-%dT23:59:59")" --until=$(date "+%Y-%m-%dT23:59:59") --reverse $_log_options \
local -r yesterday_start="$(date -d "yesterday 00:00:00" "+%Y-%m-%dT%H:%M:%S")" | grep -cE "commit [a-f0-9]{40}") "commits"
local -r yesterday_end="$(date -d "yesterday 23:59:59" "+%Y-%m-%dT%H:%M:%S")"
local -r today_date="$(date "+%Y-%m-%d")"
local -r yesterday_date="$(date -d "yesterday" "+%Y-%m-%d")"
# Current user's totals for today
local -r my_commits_today="$(git rev-list --count --author="$my_name" $_merges \
--since="$today_start" --until="$today_end" HEAD)"
local -r my_today_stats="$(git -c log.showSignature=false log --use-mailmap $_merges \
--author="$my_name" --numstat --format='' \
--since="$today_start" --until="$today_end" $_log_options $_pathspec \
| LC_ALL=C awk -F'\t' '
$1 ~ /^[0-9]+$/ && $2 ~ /^[0-9]+$/ {
ins += $1;
del += $2;
files[$3] = 1;
}
END {
for (f in files) {
file_count++;
}
printf "%d|%d|%d", file_count + 0, ins + 0, del + 0;
}
')"
local -r my_files_today="$(echo "$my_today_stats" | awk -F'|' '{print $1}')"
local -r my_insertions_today="$(echo "$my_today_stats" | awk -F'|' '{print $2}')"
local -r my_deletions_today="$(echo "$my_today_stats" | awk -F'|' '{print $3}')"
echo -e "\tfor ${my_name} (${today_date}):"
echo -e "\t commits: ${my_commits_today}"
echo -e "\t files modified: ${my_files_today}"
echo -e "\t insertions: ${my_insertions_today}"
echo -e "\t deletions: ${my_deletions_today}"
# Compare repository totals between yesterday and today
local -r today_stats="$(git -c log.showSignature=false log --use-mailmap $_merges \
--numstat --format='%H' --since="$today_start" --until="$today_end" \
$_log_options $_pathspec | LC_ALL=C awk -F'\t' '
/^[0-9a-f]{40}$/ { commits++; next }
$1 ~ /^[0-9]+$/ && $2 ~ /^[0-9]+$/ {
ins += $1;
del += $2;
files[$3] = 1;
}
END {
for (f in files) {
file_count++;
}
printf "%d|%d|%d|%d", commits + 0, file_count + 0, ins + 0, del + 0;
}
')"
local -r yday_stats="$(git -c log.showSignature=false log --use-mailmap $_merges \
--numstat --format='%H' --since="$yesterday_start" --until="$yesterday_end" \
$_log_options $_pathspec | LC_ALL=C awk -F'\t' '
/^[0-9a-f]{40}$/ { commits++; next }
$1 ~ /^[0-9]+$/ && $2 ~ /^[0-9]+$/ {
ins += $1;
del += $2;
files[$3] = 1;
}
END {
for (f in files) {
file_count++;
}
printf "%d|%d|%d|%d", commits + 0, file_count + 0, ins + 0, del + 0;
}
')"
local -r today_commits="$(echo "$today_stats" | awk -F'|' '{print $1}')"
local -r today_files="$(echo "$today_stats" | awk -F'|' '{print $2}')"
local -r today_insertions="$(echo "$today_stats" | awk -F'|' '{print $3}')"
local -r today_deletions="$(echo "$today_stats" | awk -F'|' '{print $4}')"
local -r yday_commits="$(echo "$yday_stats" | awk -F'|' '{print $1}')"
local -r yday_files="$(echo "$yday_stats" | awk -F'|' '{print $2}')"
local -r yday_insertions="$(echo "$yday_stats" | awk -F'|' '{print $3}')"
local -r yday_deletions="$(echo "$yday_stats" | awk -F'|' '{print $4}')"
echo -e "\n\trepo comparison (${yesterday_date} -> ${today_date}):"
echo -e "\t commits: ${yday_commits} -> ${today_commits} (delta: $((today_commits - yday_commits)))"
echo -e "\t files modified: ${yday_files} -> ${today_files} (delta: $((today_files - yday_files)))"
echo -e "\t insertions: ${yday_insertions} -> ${today_insertions} (delta: $((today_insertions - yday_insertions)))"
echo -e "\t deletions: ${yday_deletions} -> ${today_deletions} (delta: $((today_deletions - yday_deletions)))"
# Most changed files today (all authors)
echo -e "\n\tmost changed files today:"
local -r top_changed_files="$(git -c log.showSignature=false log --use-mailmap $_merges \
--numstat --format='' --since="$today_start" --until="$today_end" \
$_log_options $_pathspec | LC_ALL=C awk -F'\t' '
$1 ~ /^[0-9]+$/ && $2 ~ /^[0-9]+$/ {
files[$3] += ($1 + $2);
ins[$3] += $1;
del[$3] += $2;
}
END {
for (f in files) {
printf "%d\t%d\t%d\t%s\n", files[f], ins[f], del[f], f;
}
}
' | sort -nr | head -n 5)"
if [[ -n "$top_changed_files" ]]; then
echo "$top_changed_files" | LC_ALL=C awk -F'\t' '{
printf "\t %s (total: %d, +%d, -%d)\n", $4, $1, $2, $3;
}'
else
echo -e "\t no changed files found for today"
fi
# First and last commit of today
local -r first_today_commit="$(git -c log.showSignature=false log --use-mailmap $_merges \
--reverse --since="$today_start" --until="$today_end" \
--date=iso --format='%ad | %aN | %s' $_log_options $_pathspec | head -n 1)"
local -r last_today_commit="$(git -c log.showSignature=false log --use-mailmap $_merges \
--since="$today_start" --until="$today_end" \
--date=iso --format='%ad | %aN | %s' $_log_options $_pathspec | head -n 1)"
echo -e "\n\ttoday commit window:"
if [[ -n "$first_today_commit" ]]; then
echo -e "\t first commit: ${first_today_commit}"
echo -e "\t last commit: ${last_today_commit}"
else
echo -e "\t no commits found for today"
fi
# Most active users today (excluding current user)
echo -e "\n\tmost active users today (excluding you):"
local -r active_users="$(git -c log.showSignature=false log --use-mailmap $_merges \
--since="$today_start" --until="$today_end" --format='%aN|%aE' \
$_log_options $_pathspec | LC_ALL=C awk -F'|' -v git_name="$my_name" -v git_email="$my_email" '
$1 != git_name && $2 != git_email {
key = $1 " <" $2 ">";
count[key]++;
}
END {
for (k in count) {
printf "%d\t%s\n", count[k], k;
}
}
' | sort -nr | head -n 5)"
if [[ -n "$active_users" ]]; then
echo "$active_users" | LC_ALL=C awk -F'\t' '{
printf "\t %s commits - %s\n", $1, $2;
}'
else
echo -e "\t no additional active users today"
fi
} }
################################################################################ ################################################################################
@ -943,7 +650,7 @@ function csvOutput() {
printf "author,insertions,insertions_per,deletions,deletions_per,files," printf "author,insertions,insertions_per,deletions,deletions_per,files,"
printf "files_per,commits,commits_per,lines_changed,lines_changed_per\n" printf "files_per,commits,commits_per,lines_changed,lines_changed_per\n"
git -c log.showSignature=false log ${_branch} --use-mailmap $_merges --shortstat --cc \ git -c log.showSignature=false log ${_branch} --use-mailmap $_merges --numstat \
--pretty="format:commit %H%nAuthor: %aN <%aE>%nDate: %ad%n%n%w(0,4,4)%B%n" \ --pretty="format:commit %H%nAuthor: %aN <%aE>%nDate: %ad%n%n%w(0,4,4)%B%n" \
"$_since" "$_until" $_log_options $_pathspec | filter_ignored_authors | LC_ALL=C awk ' "$_since" "$_until" $_log_options $_pathspec | filter_ignored_authors | LC_ALL=C awk '
function printStats(author) { function printStats(author) {
@ -994,34 +701,14 @@ function csvOutput() {
if(last[author] == "" ) { last[author] = first[author] } if(last[author] == "" ) { last[author] = first[author] }
} }
/file changed|files changed/ { /^[0-9]/ {
files = 0 more[author] += $1
insertions = 0 less[author] += $2
deletions = 0
split($0, stats, ",") file[author] += 1
for (i in stats) { more["total"] += $1
value = stats[i] less["total"] += $2
gsub(/^ +| +$/, "", value) file["total"] += 1
if (value ~ /file changed|files changed/) {
gsub(/[^0-9]/, "", value)
files = value + 0
} else if (value ~ /insertion/) {
gsub(/[^0-9]/, "", value)
insertions = value + 0
} else if (value ~ /deletion/) {
gsub(/[^0-9]/, "", value)
deletions = value + 0
}
}
more[author] += insertions
less[author] += deletions
file[author] += files
more["total"] += insertions
less["total"] += deletions
file["total"] += files
} }
END { END {
@ -1176,42 +863,7 @@ function newContributors() {
local firstCommit=$(git -c log.showSignature=false log --author="$c" \ local firstCommit=$(git -c log.showSignature=false log --author="$c" \
--reverse --use-mailmap $_merges "$_since" "$_until" \ --reverse --use-mailmap $_merges "$_since" "$_until" \
--format='%at' $_log_options $_pathspec | filter_ignored_authors | head -n 1) --format='%at' $_log_options $_pathspec | filter_ignored_authors | head -n 1)
if [[ $firstCommit -ge $($_DATE_CMD -d "$newDate" +%s) ]]; then if [[ $firstCommit -ge $(date -d "$newDate" +%s) ]]; then
echo "$c"
fi
done
}
################################################################################
# DESC: Lists all new contributors to a repo since a specified git tag
# ARGS: $tag (required): Git tag to use as the cutoff
# OUTS: None
################################################################################
function newContributorsSinceTag() {
local tag="${1:-}"
[[ -z "$tag" ]] && { echo "Usage: newContributorsSinceTag <tag>"; return 1; }
if ! git rev-parse "$tag" >/dev/null 2>&1; then
echo "Error: Tag '$tag' does not exist."
return 1
fi
local tagDate=$(git log -n 1 --format='%ai' "$tag" | cut -d' ' -f1)
if [[ -z "$tagDate" ]]; then
echo "Error: Could not determine date for tag '$tag'."
return 1
fi
optionPicked "New contributors since tag '$tag' ($tagDate):"
local contributors=$(git -c log.showSignature=false log --use-mailmap $_merges \
"$_since" "$_until" --format='%aE' $_log_options \
$_pathspec | sort -u)
for c in $contributors; do
local firstCommit=$(git -c log.showSignature=false log --author="$c" \
--reverse --use-mailmap $_merges "$_since" "$_until" \
--format='%at' $_log_options $_pathspec | filter_ignored_authors | head -n 1)
if [[ $firstCommit -ge $($_DATE_CMD -d "$tagDate" +%s) ]]; then
echo "$c" echo "$c"
fi fi
done done
@ -1276,7 +928,7 @@ function parse_year() {
# Handle the raw UNIX timestamp format i.e. 1697375696 +0000 # Handle the raw UNIX timestamp format i.e. 1697375696 +0000
if [[ "$date_str" =~ ^[0-9]+(\ [+-][0-9]{4})?$ ]]; then if [[ "$date_str" =~ ^[0-9]+(\ [+-][0-9]{4})?$ ]]; then
timestamp=$(echo "$date_str" | awk '{print $1}') timestamp=$(echo "$date_str" | awk '{print $1}')
year=$($_DATE_CMD -d "@$timestamp" '+%Y' 2>/dev/null) year=$(date -d "@$timestamp" '+%Y' 2>/dev/null)
else else
# Default case can get funky. We need to create a clever regex to # Default case can get funky. We need to create a clever regex to
# handle the default case which is like Mon Oct 15 12:34:56 2023 +0000 # handle the default case which is like Mon Oct 15 12:34:56 2023 +0000
@ -1297,7 +949,7 @@ function parse_year() {
date_str=$(echo "$date_str" | awk -F'/' '{print $2"/"$1"/"$3}') date_str=$(echo "$date_str" | awk -F'/' '{print $2"/"$1"/"$3}')
fi fi
# Extract the final date # Extract the final date
year=$($_DATE_CMD -d "$date_str" '+%Y' 2>/dev/null) year=$(date -d "$date_str" '+%Y' 2>/dev/null)
fi fi
echo "$year" echo "$year"
@ -1593,20 +1245,11 @@ if [[ "$#" -eq 1 ]]; then
# what people may try. This script doesn't provide any additional # what people may try. This script doesn't provide any additional
# output for a bad date since `date`'s STDERR already contains # output for a bad date since `date`'s STDERR already contains
# useful information. # useful information.
if ! $_DATE_CMD -d "${newDate}" +%s > /dev/null 2>&1; then if ! date -d "${newDate}" +%s > /dev/null 2>&1; then
newDate="" newDate=""
fi fi
done done
newContributors "${newDate}";; newContributors "${newDate}";;
-N|--new-contributors-since-tag)
while [[ -z "${_tag}" ]]; do
read -r -p "Which tag? " _tag
if ! git rev-parse "${_tag}" >/dev/null 2>&1; then
echo "Error: Tag '${_tag}' does not exist."
_tag=""
fi
done
newContributorsSinceTag "${_tag}";;
-a|--commits-per-author) commitsPerAuthor;; -a|--commits-per-author) commitsPerAuthor;;
-d|--commits-per-day) commitsPerDay;; -d|--commits-per-day) commitsPerDay;;
-Y|--commits-by-year ) commitsByYear;; -Y|--commits-by-year ) commitsByYear;;
@ -1632,14 +1275,13 @@ if [[ "$#" -eq 1 ]]; then
read -r -p "Which author? " author read -r -p "Which author? " author
done done
commitsByTimezone "${author}";; commitsByTimezone "${author}";;
# CALENDAR OPTIONS # ACTIVITY OPTIONS
-k|--commits-calendar-by-author) -k|--commits-calendar-by-author)
author="${_GIT_AUTHOR:-}" author="${_GIT_AUTHOR:-}"
while [[ -z "${author}" ]]; do while [[ -z "${author}" ]]; do
read -r -p "Which author? " author read -r -p "Which author? " author
done done
commitsCalendarByAuthor "${author}";; commitsCalendarByAuthor "${author}";;
-H|--commits-heatmap) commitsHeatmap;;
# SUGGEST OPTIONS # SUGGEST OPTIONS
-r|--suggest-reviewers) suggestReviewers;; -r|--suggest-reviewers) suggestReviewers;;
-h|-\?|--help) usage;; -h|-\?|--help) usage;;
@ -1699,48 +1341,39 @@ if [[ "$#" -eq 0 ]]; then
11) newDate="" 11) newDate=""
while [[ -z "${newDate}" ]]; do while [[ -z "${newDate}" ]]; do
read -r -p "Since what date? (e.g. '2023-04-13', '13 April 2023', 'last Thursday') " newDate read -r -p "Since what date? (e.g. '2023-04-13', '13 April 2023', 'last Thursday') " newDate
if ! $_DATE_CMD -d "${newDate}" +%s > /dev/null 2>&1; then if ! date -d "${newDate}" +%s > /dev/null 2>&1; then
newDate="" newDate=""
fi fi
done done
newContributors "${newDate}"; showMenu;; newContributors "${newDate}"; showMenu;;
12) while [[ -z "${_tag}" ]]; do 12) commitsPerAuthor; showMenu;;
read -r -p "Which tag? " _tag 13) commitsPerDay; showMenu;;
if ! git rev-parse "${_tag}" >/dev/null 2>&1; then 14) commitsByMonth; showMenu;;
echo "Error: Tag '${_tag}' does not exist." 15) commitsByYear; showMenu;;
_tag="" 16) commitsByWeekday; showMenu;;
fi 17) author=""
done
newContributorsSinceTag "${_tag}"; showMenu;;
13) commitsPerAuthor; showMenu;;
14) commitsPerDay; showMenu;;
15) commitsByMonth; showMenu;;
16) commitsByYear; showMenu;;
17) commitsByWeekday; showMenu;;
18) author=""
while [[ -z "${author}" ]]; do while [[ -z "${author}" ]]; do
read -r -p "Which author? " author read -r -p "Which author? " author
done done
commitsByWeekday "${author}"; showMenu;; commitsByWeekday "${author}"; showMenu;;
19) commitsByHour; showMenu;; 18) commitsByHour; showMenu;;
20) author="" 19) author=""
while [[ -z "${author}" ]]; do while [[ -z "${author}" ]]; do
read -r -p "Which author? " author read -r -p "Which author? " author
done done
commitsByHour "${author}"; showMenu;; commitsByHour "${author}"; showMenu;;
21) commitsByTimezone; showMenu;; 20) commitsByTimezone; showMenu;;
22) author="" 21) author=""
while [[ -z "${author}" ]]; do while [[ -z "${author}" ]]; do
read -r -p "Which author? " author read -r -p "Which author? " author
done done
commitsByTimezone "${author}"; showMenu;; commitsByTimezone "${author}"; showMenu;;
23) suggestReviewers; showMenu;; 22) suggestReviewers; showMenu;;
24) author="" 23) author=""
while [[ -z "${author}" ]]; do while [[ -z "${author}" ]]; do
read -r -p "Which author? " author read -r -p "Which author? " author
done done
commitsCalendarByAuthor "${author}"; showMenu;; commitsCalendarByAuthor "${author}"; showMenu;;
25) commitsHeatmap; showMenu;;
q|"\n") exit;; q|"\n") exit;;
*) clear; optionPicked "Pick an option from the menu"; showMenu;; *) clear; optionPicked "Pick an option from the menu"; showMenu;;
esac esac

View file

@ -1,233 +1,213 @@
.TH git-quick-stats "1" "June 2025" "git-quick-stats" "User Commands" .TH git-quick-stats "1" "June 2025" "git-quick-stats" "User Commands"
.SH NAME .SH NAME
.B git\-quick\-stats .B git\-quick\-stats
\- Simple and efficient way to access various stats in a git repository. \- Simple and efficient way to access various stats in a git repository.
.SH SYNOPSIS .SH SYNOPSIS
.PP .PP
For non\-interactive mode: For non\-interactive mode:
.B git\-quick\-stats [OPTIONS] .B git\-quick\-stats [OPTIONS]
.PP .PP
For interactive mode: For interactive mode:
.B git-quick-stats .B git-quick-stats
.PP .PP
.SH DESCRIPTION .SH DESCRIPTION
.PP .PP
Any git repository contains tons of information about commits, contributors, Any git repository contains tons of information about commits, contributors,
and files. Extracting this information is not always trivial, mostly because and files. Extracting this information is not always trivial, mostly because
of a gadzillion options to a gadzillion git commands. of a gadzillion options to a gadzillion git commands.
This program allows you to see detailed information about a git repository. This program allows you to see detailed information about a git repository.
.PP .PP
.SH PLATFORM NOTES .SH GENERATE OPTIONS
.PP .PP
git-quick-stats requires GNU date support for date parsing options. \fB\-T\fR, \fB\-\-detailed\-git\-stats\fR
.PP .IP
On macOS, install GNU coreutils with: give a detailed list of git stats
.PP .HP
.B brew install coreutils .PP
.PP \fB\-R\fR, \fB\-\-git\-stats\-by\-branch\fR
On FreeBSD, install GNU coreutils with: .IP
.PP see detailed list of git stats by branch
.B pkg install coreutils .HP
.PP .PP
GNU date may be available as either \fB\-c\fR, \fB\-\-changelogs\fR
.B date .IP
or see changelogs
.B gdate .HP
and git-quick-stats auto-detects both. .PP
.PP \fB\-L\fR, \fB\-\-changelogs\-by\-author\fR
.SH GENERATE OPTIONS .IP
.PP see changelogs by author
\fB\-h\fR, \-?, \fB\-\-help\fR .HP
.IP .PP
display this help text in the terminal \fB\-S\fR, \fB\-\-my\-daily\-stats\fR
.PP .IP
\fB\-T\fR, \fB\-\-detailed\-git\-stats\fR see your current daily stats
.IP .HP
give a detailed list of git stats .PP
.HP \fB\-V\fR, \fB\-\-csv\-output\-by\-branch\fR
.PP .IP
\fB\-R\fR, \fB\-\-git\-stats\-by\-branch\fR output daily stats by branch in CSV format
.IP .HP
see detailed list of git stats by branch .PP
.HP \fB\-j\fR, \fB\-\-json\-output\fR
.PP .IP
\fB\-c\fR, \fB\-\-changelogs\fR save git log as a JSON formatted file to a specified area
.IP .HP
see changelogs .SH LIST OPTIONS
.HP .PP
.PP \fB\-b\fR, \fB\-\-branch\-tree\fR
\fB\-L\fR, \fB\-\-changelogs\-by\-author\fR .IP
.IP show an ASCII graph of the git repo branch history
see changelogs by author .HP
.HP .PP
.PP \fB\-D\fR, \fB\-\-branches\-by\-date\fR
\fB\-S\fR, \fB\-\-my\-daily\-stats\fR .IP
.IP show branches by date
see your current daily stats .HP
.HP .PP
.PP \fB\-C\fR, \fB\-\-contributors\fR
\fB\-V\fR, \fB\-\-csv\-output\-by\-branch\fR .IP
.IP see a list of everyone who contributed to the repo
output daily stats by branch in CSV format .HP
.HP .PP
.PP \fB\-n\fR, \fB\-\-new\-contributors\fR
\fB\-j\fR, \fB\-\-json\-output\fR .IP
.IP list everyone who made their first contribution since a specified date
save git log as a JSON formatted file to a specified area .HP
.HP .PP
.SH LIST OPTIONS \fB\-a\fR, \fB\-\-commits\-per\-author\fR
.PP .IP
\fB\-b\fR, \fB\-\-branch\-tree\fR displays a list of commits per author
.IP .HP
show an ASCII graph of the git repo branch history .PP
.HP \fB\-d\fR, \fB\-\-commits\-per\-day\fR
.PP .IP
\fB\-D\fR, \fB\-\-branches\-by\-date\fR displays a list of commits per day
.IP .HP
show branches by date .PP
.HP \fB\-m\fR, \fB\-\-commits\-by\-month\fR
.PP .IP
\fB\-C\fR, \fB\-\-contributors\fR displays a list of commits per month
.IP .HP
see a list of everyone who contributed to the repo .PP
.HP \fB\-Y\fR, \fB\-\-commits\-by\-year\fR
.PP .IP
\fB\-n\fR, \fB\-\-new\-contributors\fR displays a list of commits per year
.IP .HP
list everyone who made their first contribution since a specified date .PP
.HP \fB\-w\fR, \fB\-\-commits\-by\-weekday\fR
.PP .IP
\fB\-N\fR, \fB\-\-new\-contributors\-since\-tag\fR displays a list of commits per weekday
.IP .HP
list everyone who made their first contribution since a specified git tag .PP
.HP \fB\-W\fR, \fB\-\-commits\-by\-author\-by\-weekday\fR
.PP .IP
\fB\-a\fR, \fB\-\-commits\-per\-author\fR displays a list of commits per weekday by author
.IP .HP
displays a list of commits per author .PP
.HP \fB\-o\fR, \fB\-\-commits\-by\-hour\fR
.PP .IP
\fB\-d\fR, \fB\-\-commits\-per\-day\fR displays a list of commits per hour
.IP .HP
displays a list of commits per day .PP
.HP \fB\-A\fR, \fB\-\-commits\-by\-author\-by\-hour\fR
.PP .IP
\fB\-m\fR, \fB\-\-commits\-by\-month\fR displays a list of commits per hour by author
.IP .HP
displays a list of commits per month .PP
.HP \fB\-z\fR, \fB\-\-commits\-by\-timezone\fR
.PP .IP
\fB\-Y\fR, \fB\-\-commits\-by\-year\fR displays a list of commits per timezone
.IP .HP
displays a list of commits per year .PP
.HP \fB\-Z\fR, \fB\-\-commits\-by\-author\-by\-timezone\fR
.PP .IP
\fB\-w\fR, \fB\-\-commits\-by\-weekday\fR displays a list of commits per timezone by author
.IP .HP
displays a list of commits per weekday .PP
.HP \fB\-\-activity\-calendar\fR
.PP .IP
\fB\-W\fR, \fB\-\-commits\-by\-author\-by\-weekday\fR displays a calendar-style grid of commit activity per day-of-week and month for a selected author.
.IP .HP
displays a list of commits per weekday by author .SH SUGGEST OPTIONS
.HP .PP
.PP \fB\-r\fR, \fB\-\-suggest\-reviewers\fR
\fB\-o\fR, \fB\-\-commits\-by\-hour\fR .IP
.IP show the best people to contact to review code
displays a list of commits per hour .HP
.HP .PP
.PP \fB\-h\fR, \-?, \fB\-\-help\fR
\fB\-A\fR, \fB\-\-commits\-by\-author\-by\-hour\fR .IP
.IP display this help text in the terminal
displays a list of commits per hour by author .PP
.HP .SH ADDITIONAL USAGE
.PP You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log, example:
\fB\-z\fR, \fB\-\-commits\-by\-timezone\fR .PP
.IP .B export _GIT_SINCE="2017\-01\-20"
displays a list of commits per timezone .PP
.HP You can set _GIT_LIMIT for limited output log, example:
.PP .PP
\fB\-Z\fR, \fB\-\-commits\-by\-author\-by\-timezone\fR .B export _GIT_LIMIT=20
.IP .PP
displays a list of commits per timezone by author You can set _GIT_LOG_OPTIONS for git log options, example:
.HP .PP
.PP .B export _GIT_LOG_OPTIONS="--ignore-all-space --ignore-blank-lines"
\fB\-\-activity\-calendar\fR .PP
.IP You can exclude directories or files from the stats by using pathspec, example:
displays a calendar-style grid of commit activity per day-of-week and month for a selected author. .PP
.HP .B export _GIT_PATHSPEC=':!pattern'
.SH SUGGEST OPTIONS .PP
.PP You can set _GIT_MERGE_VIEW to show merge commits with normal commits, example:
\fB\-r\fR, \fB\-\-suggest\-reviewers\fR .PP
.IP .B export _GIT_MERGE_VIEW="enable"
show the best people to contact to review code .PP
.HP You can also set _GIT_MERGE_VIEW to only show merge commits, example:
.PP .PP
.SH CALENDAR OPTIONS .B export _GIT_MERGE_VIEW="exclusive"
.PP .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. 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 .PP
.PP .B export _GIT_SORT_BY="name-asc"
\fB\-H\fR, \fB\-\-commits\-heatmap\fR shows a heatmap of commits per day per hour for the last 30 days .PP
.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:
.SH ADDITIONAL USAGE .PP
You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log, example: .B export _MENU_THEME=legacy
.PP .PP
.B export _GIT_SINCE="2017\-01\-20" or
.PP .B export _MENU_THEME=none
You can set _GIT_LIMIT for limited output log, example: .PP
.PP You can set _GIT_BRANCH to set the branch of the stats, example:
.B export _GIT_LIMIT=20 .PP
.PP .B export _GIT_BRANCH="master"
You can set _GIT_TAG to define the default tag used by the "new contributors since tag" option, example: .PP
.PP .SH Calendar activity output
.B export _GIT_TAG="foo" .PP
.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.
You can set _GIT_LOG_OPTIONS for git log options, example: .PP
.PP Sample output:
.B export _GIT_LOG_OPTIONS="--ignore-all-space --ignore-blank-lines" .PP
.PP .nf
You can exclude directories or files from the stats by using pathspec, example: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
.PP Mon ▓▓▓ ░░░ ▒▒▒ ░░░ ░░░ ▒▒▒ ▓▓▓ ░░░ ░░░ ▓▓▓ ▒▒▒ ▒▒▒
.B export _GIT_PATHSPEC=':!pattern' Tue ▒▒▒ ░░░ ▒▒▒ ░░░ ▒▒▒ ░░░ ▒▒▒ ▓▓▓ ▒▒▒ ░░░ ░░░ ░░░
.PP Wed ░░░ ▓▓▓ ░░░ ▓▓▓ ▒▒▒ ░░░ ░░░ ▒▒▒ ░░░ ░░░ ▓▓▓ ░░░
You can set _GIT_MERGE_VIEW to show merge commits with normal commits, example: Thu ░░░ ▒▒▒ ░░░ ░░░ ▒▒▒ ░░░ ▓▓▓ ▒▒▒ ▒▒▒ ░░░ ░░░ ▒▒▒
.PP Fri ▒▒▒ ░░░ ▒▒▒ ▓▓▓ ░░░ ▓▓▓ ▒▒▒ ░░░ ▒▒▒ ░░░ ▒▒▒ ░░░
.B export _GIT_MERGE_VIEW="enable" Sat ░░░ ░░░ ▒▒▒ ░░░ ░░░ ░░░ ▒▒▒ ░░░ ▒▒▒ ▓▓▓ ▒▒▒ ░░░
.PP Sun ▓▓▓ ░░░ ▓▓▓ ░░░ ░░░ ▓▓▓ ░░░ ▒▒▒ ░░░ ░░░ ▓▓▓ ░░░
You can also set _GIT_MERGE_VIEW to only show merge commits, example:
.PP Legend: ... = 0 ░░░ = 12 ▒▒▒ = 35 ▓▓▓ = 6+ commits
.B export _GIT_MERGE_VIEW="exclusive" .PP
.PP You can set _GIT_IGNORE_AUTHORS to filter out specific authors, example:
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
.PP .B export _GIT_IGNORE_AUTHORS="(author@examle.com|username)"
.B export _GIT_SORT_BY="name-asc" .
.PP .fi
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 .PP
.B export _MENU_THEME=legacy .SH SEE ALSO
.PP .BR git (1)
or .PP
.B export _MENU_THEME=none Project homepage:
.PP .UR https://github.com/git-quick-stats/git-quick-stats
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 .UE

View file

@ -52,8 +52,6 @@ LIST OPTIONS
see a list of everyone who contributed to the repo see a list of everyone who contributed to the repo
-n, --new-contributors -n, --new-contributors
list everyone who made their first contribution since a specified date list everyone who made their first contribution since a specified date
-N, --new-contributors-since-tag
list everyone who made their first contribution since a specified tag
-a, --commits-per-author -a, --commits-per-author
displays a list of commits per author displays a list of commits per author
-d, --commits-per-day -d, --commits-per-day
@ -75,12 +73,6 @@ LIST OPTIONS
-Z, --commits-by-author-by-timezone -Z, --commits-by-author-by-timezone
displays a list of commits per timezone by author 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 SUGGEST OPTIONS
-r, --suggest-reviewers -r, --suggest-reviewers
show the best people to contact to review code show the best people to contact to review code
@ -108,9 +100,7 @@ ADDITIONAL USAGE
You can set _GIT_IGNORE_AUTHORS to filter out specific authors You can set _GIT_IGNORE_AUTHORS to filter out specific authors
ex: export _GIT_IGNORE_AUTHORS=\"(author1|author2)\" 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\" 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 assert_raises "$src fail" 1
@ -123,11 +113,6 @@ assert_success "$src --detailed-git-stats"
assert_contains "$src --commits-per-day" "Git commits per date" assert_contains "$src --commits-per-day" "Git commits per date"
assert_success "$src --commits-per-day" assert_success "$src --commits-per-day"
assert_contains "$src --my-daily-stats" "My daily status"
assert_contains "$src --my-daily-stats" "most changed files today"
assert_contains "$src --my-daily-stats" "most active users today (excluding you)"
assert_success "$src --my-daily-stats"
assert_startswith "$src --commits-by-year" "Git commits by year" assert_startswith "$src --commits-by-year" "Git commits by year"
assert_success "$src --commits-by-year" assert_success "$src --commits-by-year"