Compare commits

..

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

10 changed files with 864 additions and 1532 deletions

5
.github/FUNDING.yml vendored
View file

@ -1 +1,6 @@
# These are supported funding model platforms # These are supported funding model platforms
github: [arzzen]
open_collective: git-quick-stats
ko_fi: lukasmestan
custom: ['https://lukasmestan.com/thanks/']

View file

@ -1,3 +1,3 @@
Lukas <test@gmail.com> Lukáš <arzzen@users.noreply.github.com> Lukas Mestan <lukas.mestan@gmail.com> Lukáš Mešťan <arzzen@users.noreply.github.com>
Lukas <lukas@gmail.com> arzzen Lukas Mestan <lukas.mestan@gmail.com> arzzen

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 \
@ -23,6 +23,5 @@ ENV _GIT_SINCE= \
TERM=xterm-256color TERM=xterm-256color
WORKDIR /git WORKDIR /git
RUN git config --global --add safe.directory /git
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint" ] ENTRYPOINT [ "/usr/local/bin/docker-entrypoint" ]
CMD [ "/usr/bin/git", "quick-stats" ] CMD [ "/usr/bin/git", "quick-stats" ]

View file

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2024 git-quick-stats.sh Copyright (c) 2021 Lukáš Mešťan
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -30,8 +30,8 @@ uninstall:
@$(TASK_DONE) @$(TASK_DONE)
reinstall: reinstall:
@curl -sO https://raw.githubusercontent.com/git-quick-stats/git-quick-stats/master/git-quick-stats @curl -sO https://raw.githubusercontent.com/arzzen/git-quick-stats/master/git-quick-stats
@curl -sO https://raw.githubusercontent.com/git-quick-stats/git-quick-stats/master/git-quick-stats.1 @curl -sO https://raw.githubusercontent.com/arzzen/git-quick-stats/master/git-quick-stats.1
$(MAKE) install $(MAKE) install
@$(TASK_DONE) @$(TASK_DONE)

830
README.md
View file

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

File diff suppressed because it is too large Load diff

View file

@ -1,233 +1,171 @@
.TH git-quick-stats "1" "June 2025" "git-quick-stats" "User Commands" .TH git-quick-stats "1" "April 2024" "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 .SH SUGGEST OPTIONS
.HP .PP
.PP \fB\-r\fR, \fB\-\-suggest\-reviewers\fR
\fB\-W\fR, \fB\-\-commits\-by\-author\-by\-weekday\fR .IP
.IP show the best people to contact to review code
displays a list of commits per weekday by author .HP
.HP .PP
.PP \fB\-h\fR, \-?, \fB\-\-help\fR
\fB\-o\fR, \fB\-\-commits\-by\-hour\fR .IP
.IP display this help text in the terminal
displays a list of commits per hour .PP
.HP .SH ADDITIONAL USAGE
.PP You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log, example:
\fB\-A\fR, \fB\-\-commits\-by\-author\-by\-hour\fR .PP
.IP .B export _GIT_SINCE="2017\-01\-20"
displays a list of commits per hour by author .PP
.HP You can set _GIT_LIMIT for limited output log, example:
.PP .PP
\fB\-z\fR, \fB\-\-commits\-by\-timezone\fR .B export _GIT_LIMIT=20
.IP .PP
displays a list of commits per timezone 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\-Z\fR, \fB\-\-commits\-by\-author\-by\-timezone\fR .PP
.IP You can exclude directories or files from the stats by using pathspec, example:
displays a list of commits per timezone by author .PP
.HP .B export _GIT_PATHSPEC=':!pattern'
.PP .PP
\fB\-\-activity\-calendar\fR You can set _GIT_MERGE_VIEW to show merge commits with normal commits, example:
.IP .PP
displays a calendar-style grid of commit activity per day-of-week and month for a selected author. .B export _GIT_MERGE_VIEW="enable"
.HP .PP
.SH SUGGEST OPTIONS You can also set _GIT_MERGE_VIEW to only show merge commits, example:
.PP .PP
\fB\-r\fR, \fB\-\-suggest\-reviewers\fR .B export _GIT_MERGE_VIEW="exclusive"
.IP .PP
show the best people to contact to review code You can switch to the legacy color scheme, example:
.HP .PP
.PP .B export _MENU_THEME=legacy
.SH CALENDAR OPTIONS .PP
.PP You can set _GIT_BRANCH to set the branch of the stats, example:
\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 .B export _GIT_BRANCH="master"
.PP .
\fB\-H\fR, \fB\-\-commits\-heatmap\fR shows a heatmap of commits per day per hour for the last 30 days .fi
.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_TAG to define the default tag used by the "new contributors since tag" option, example:
.PP
.B export _GIT_TAG="foo"
.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

View file

@ -11,7 +11,7 @@
. tests/assert.sh -v . tests/assert.sh -v
src="./git-quick-stats" src="./git-quick-stats"
assert "$src fail" "Invalid argument: fail assert "$src fail" "Invalid argument
NAME NAME
git-quick-stats - Simple and efficient way to access various stats in a git repo git-quick-stats - Simple and efficient way to access various stats in a git repo
@ -24,7 +24,7 @@ DESCRIPTION
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.
GENERATE OPTIONS GENERATE OPTIONS
@ -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
@ -100,34 +92,22 @@ ADDITIONAL USAGE
ex: export _GIT_MERGE_VIEW=enable ex: export _GIT_MERGE_VIEW=enable
You can also set _GIT_MERGE_VIEW to only show merge commits You can also set _GIT_MERGE_VIEW to only show merge commits
ex: export _GIT_MERGE_VIEW=exclusive ex: export _GIT_MERGE_VIEW=exclusive
You can change to the legacy color scheme by toggling the variable \"_MENU_THEME\" between \"default\" and \"legacy\". You can set _MENU_THEME to display the legacy color scheme
You can completely disable the color theme by setting the \"_MENU_THEME\" variable to \"none\".
ex: export _MENU_THEME=legacy ex: export _MENU_THEME=legacy
You can set _GIT_BRANCH to set the branch of the stats You can set _GIT_BRANCH to set the branch of the stats
ex: export _GIT_BRANCH=master ex: export _GIT_BRANCH=master"
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\"
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
assert_contains "$src --suggest-reviewers" "Suggested code reviewers (based on git history)" assert_contains "$src --suggest-reviewers" "Suggested code reviewers (based on git history)"
assert_success "$src --suggest-reviewers" assert_success "$src --suggest-reviewers"
assert_contains "$src --detailed-git-stats" "Contribution stats (by author) on the current branch" assert_contains "$src --detailed-git-stats" "Contribution stats"
assert_success "$src --detailed-git-stats" 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"