Compare commits

..

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

26 changed files with 1326 additions and 2606 deletions

1
.github/FUNDING.yml vendored
View file

@ -1 +0,0 @@
# These are supported funding model platforms

View file

@ -1,38 +0,0 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View file

@ -1,20 +0,0 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

13
.gitignore vendored
View file

@ -1,13 +0,0 @@
*.json
*.db
.DS_Store*
._*
.*.swp
.*.swo
.Spotlight*
.Trash*
**/*~
nbproject/*
/tests/test-git/.git/
#/tests/test-git/*
!/tests/test-git/resetgit

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

@ -11,6 +11,8 @@ addons:
- cmake - cmake
install: install:
- git checkout ${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH}
- git branch --set-upstream-to origin/$TRAVIS_BRANCH
- git rev-parse HEAD - git rev-parse HEAD
script: make test script: make test

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

@ -1,28 +0,0 @@
FROM alpine
# Copy sources
COPY . /app
# Install required packages & build git-quick-stats
RUN apk add --no-cache bash git make ncurses coreutils util-linux \
&& cd /app \
&& make install \
&& rm -rf /app \
&& apk del --no-cache make \
&& mkdir -p /usr/local/bin \
&& echo -en "#!/bin/bash\nset -e\n[[ \"\${1::1}\" == '-' ]] && set -- /usr/bin/git quick-stats \"\$@\"\nexec \"\$@\"" \
> /usr/local/bin/docker-entrypoint \
&& chmod +x /usr/local/bin/docker-entrypoint
# Declare all variables usables by git-quick-stats
ENV _GIT_SINCE= \
_GIT_UNTIL= \
_GIT_LIMIT= \
_GIT_PATHSPEC= \
_MENU_THEME=default \
TERM=xterm-256color
WORKDIR /git
RUN git config --global --add safe.directory /git
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint" ]
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) 2018 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

@ -1,43 +1,42 @@
PREFIX ?= /usr/local PREFIX ?= /usr/local
_INSTDIR ?= $(DESTDIR)$(PREFIX)
BINDIR ?= $(_INSTDIR)/bin
MANDIR ?= $(_INSTDIR)/share/man
TASK_DONE = echo -e "\n✓ $@ done\n" TASK_DONE = echo -e "\n✓ $@ done\n"
SHELL := $(shell which bash) # files that need mode 755
EXEC_FILES=git-quick-stats
.PHONY: test .PHONY: test
all: all:
@echo "Usage:" @echo "usage: make install"
@echo " make install" @echo " make reinstall"
@echo " make reinstall" @echo " make uninstall"
@echo " make uninstall" @echo " make test"
@echo " make test"
help: help:
$(MAKE) all $(MAKE) all
@$(TASK_DONE) @$(TASK_DONE)
install: install:
install -d -m 0755 $(BINDIR) mkdir -p $(PREFIX)/bin
install -m 0755 git-quick-stats $(BINDIR)/git-quick-stats install -m 0755 $(EXEC_FILES) $(PREFIX)/bin/$(EXEC_FILES)
git config --global alias.quick-stats '! $(PREFIX)/bin/$(EXEC_FILES)'
$(MAKE) man $(MAKE) man
@$(TASK_DONE) @$(TASK_DONE)
uninstall: uninstall:
rm -f $(BINDIR)/git-quick-stats test -d $(PREFIX)/bin && \
rm -f $(MANDIR)/man1/git-quick-stats.1 cd $(PREFIX)/bin && \
rm -f $(EXEC_FILES) && \
git config --global --unset alias.quick-stats
@$(TASK_DONE) @$(TASK_DONE)
reinstall: reinstall:
@curl -sO https://raw.githubusercontent.com/git-quick-stats/git-quick-stats/master/git-quick-stats @curl -s https://raw.githubusercontent.com/arzzen/git-quick-stats/master/git-quick-stats > git-quick-stats
@curl -sO https://raw.githubusercontent.com/git-quick-stats/git-quick-stats/master/git-quick-stats.1 $(MAKE) uninstall && \
$(MAKE) install $(MAKE) install
@$(TASK_DONE) @$(TASK_DONE)
man: man:
install -d -m 0755 $(MANDIR)/man1/ install -g 0 -o 0 -m 0644 git-quick-stats.1 /usr/share/man/man1/
install -m 0644 git-quick-stats.1 $(MANDIR)/man1/
test: test:
tests/commands_test.sh tests/commands_test.sh

646
README.md
View file

@ -1,433 +1,213 @@
# 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)
[![Travis](https://api.travis-ci.org/arzzen/git-quick-stats.svg?branch=master)](https://travis-ci.org/arzzen/git-quick-stats)
> `git-quick-stats` is a simple and efficient way to access various statistics in a git repository. [![Homebrew package](https://repology.org/badge/version-for-repo/homebrew/git-quick-stats.svg)](http://braumeister.org/formula/git-quick-stats)
> [![Linuxbrew package](https://repology.org/badge/version-for-repo/linuxbrew/git-quick-stats.svg)](https://repology.org/metapackage/git-quick-stats/packages)
> 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 :).
> `git quick-stats` is a simple and efficient way to access various statistics in git repository.
![mainImageScreenshot](https://github.com/user-attachments/assets/7d8637a4-5a67-49f6-8724-ca7548b987c6)
> Any git repository contains tons of information about commits, contributors, and files. Extracting this information is not always trivial, mostly because of a gadzillion options to a gadzillion git commands I dont think there is a single person alive who knows them all. Probably not even [Linus Torvalds](https://github.com/torvalds) himself :).
## Table of Contents
## Table of Contents
[**Screenshots**](#screenshots)
[**Screenshots**](#screenshots)
[**Usage**](#usage)
[**Installation**](#installation)
- [**Interactive**](#interactive) * [**Unix OS**](#unix-like-os)
- [**Non-interactive**](#non-interactive) * [**OS X**](#os-x-homebrew)
- [**Command-line arguments**](#command-line-arguments) * [**Windows**](#windows-cygwin)
- [**Git log since and until**](#git-log-since-and-until)
- [**Git log limit**](#git-log-limit) [**Usage**](#usage)
- [**Git log options**](#git-log-options) * [**Git log since/until**](#git-log-since-until)
- [**Git pathspec**](#git-pathspec) * [**Git log limit**](#git-log-limit)
- [**Git merge view strategy**](#git-merge-view-strategy) * [**Git pathspec**](#git-pathspec)
- [**Color themes**](#color-themes) * [**Tests**](#tests)
[**Installation**](#installation) [**System requirements**](#system-requirements)
* [**Dependences**](#dependences)
- [**UNIX and Linux**](#unix-and-linux)
- [**macOS**](#macos-homebrew) [**Contribution**](#contribution)
- [**Windows**](#windows)
- [**Docker**](#docker) [**FAQ**](#faq)
[**System requirements**](#system-requirements) [**License**](#licensing)
- [**Dependencies**](#dependencies)
## Screenshots
[**FAQ**](#faq)
![screenshot from 2017-04-02 17-10-21](https://cloud.githubusercontent.com/assets/6382002/24588459/bef0a1b8-17c8-11e7-8525-3ab5983b81dc.png)
[**Contribution**](#contribution)
![screenshot from 2017-04-02 17-09-13](https://cloud.githubusercontent.com/assets/6382002/24588456/bec1278a-17c8-11e7-8835-39273da7bc99.png)
- [**Code reviews**](#code-reviews)
- [**Some tips for good pull requests**](#some-tips-for-good-pull-requests) ![screenshot from 2017-04-02 17-09-31](https://cloud.githubusercontent.com/assets/6382002/24588457/beece9f6-17c8-11e7-80a4-274ecd314a7e.png)
- [**Formatting**](#formatting)
![screenshot from 2017-04-02 17-09-45](https://cloud.githubusercontent.com/assets/6382002/24588458/bef03656-17c8-11e7-82e6-30a5a11cfbb0.png)
[**Tests**](#tests)
![screenshot from 2017-04-02 17-08-28](https://cloud.githubusercontent.com/assets/6382002/24588460/bef0c2e2-17c8-11e7-88b2-a4033593c5d0.png)
[**Licensing**](#licensing)
[**Contributors**](#contributors) ## Usage
- [**Backers**](#backers) ```bash
- [**Sponsors**](#sponsors) git quick-stats
# or
## Screenshots git-quick-stats
```
![commitsByWeekdayScreenshot](https://github.com/user-attachments/assets/3496d245-6385-47d1-878a-726e79100eb1)
Or you can use (non-interactive) direct execution:
![commitsByHourScreenshot](https://github.com/user-attachments/assets/9f1d69d9-46e0-411d-a5ed-905ffdfb887a)
`git quick-stats <optional-command-to-execute-directly>`
![commitActivityScreenshot](https://github.com/user-attachments/assets/693fff31-65c7-4b9f-a011-6114a2d10a26)
Possible arguments in short and long form:
## Usage
```
### Interactive -r, --suggest-reviewers
show the best people to contact to review code
`git-quick-stats` has a built-in interactive menu that can be executed as such: -T, --detailed-git-stats
give a detailed list of git stats
```bash -d, --commits-per-day
git-quick-stats displays a list of commits per day
``` -m, --commits-by-month
displays a list of commits per month
Or -w, --commits-by-weekday
displays a list of commits per weekday
```bash -o, --commits-by-hour
git quick-stats displays a list of commits per hour
``` -A, --commits-by-author-by-hour
displays a list of commits per hour by author
### Non-interactive -a, --commits-per-author
displays a list of commits per author
For those who prefer to utilize command-line options, `git-quick-stats` also has a non-interactive mode supporting both short and long options: -S, --my-daily-stats
see your current daily stats
```bash -C, --contributors
git-quick-stats <optional-command-to-execute-directly> see a list of everyone who contributed to the repo
``` -b, --branch-tree
show an ASCII graph of the git repo branch history
Or -D, --branches-by-date
show branches by date
```bash -c, --changelogs
git quick-stats <optional-command-to-execute-directly> see changelogs
``` -L, --changelogs-by-author
see changelogs by author
### Command-line arguments -h, -?, --help
display this help text in the terminal
Possible arguments in short and long form: ```
```bash #### Git log since / until
GENERATE OPTIONS
-T, --detailed-git-stats You can set variable `_GIT_SINCE`, `_GIT_UNTIL` and limit the git log
give a detailed list of git stats
-R, --git-stats-by-branch ```bash
see detailed list of git stats by branch export _GIT_SINCE="2017-20-01"
-c, --changelogs export _GIT_UNTIL="2017-22-01"
see changelogs ```
-L, --changelogs-by-author
see changelogs by author then run `git quick-stats` (affect all stats, except "My daily status" and "Git changelogs" )
-S, --my-daily-stats
see your current daily stats
-V, --csv-output-by-branch #### Git log limit
output daily stats by branch in CSV format
-j, --json-output You can set variable `_GIT_LIMIT` for limited output (it will affect: "Git changelogs" and "Branch tree view" )
save git log as a JSON formatted file to a specified area
```bash
LIST OPTIONS export _GIT_LIMIT=20
-b, --branch-tree ```
show an ASCII graph of the git repo branch history
-D, --branches-by-date #### Git pathspec
show branches by date
-C, --contributors You can exclude directory from the stats by using [pathspec](https://git-scm.com/docs/gitglossary#gitglossary-aiddefpathspecapathspec)
see a list of everyone who contributed to the repo
-n, --new-contributors ```bash
list everyone who made their first contribution since a specified date export _GIT_PATHSPEC=':!directory'
-N, --new-contributors-since-tag ```
list everyone who made their first contribution since a specified git tag
-a, --commits-per-author
displays a list of commits per author ## Installation
-d, --commits-per-day
displays a list of commits per day #### Unix like OS
-m, --commits-by-month
displays a list of commits per month ```bash
-Y, --commits-by-year git clone https://github.com/arzzen/git-quick-stats.git && cd git-quick-stats
displays a list of commits per year sudo make install
-w, --commits-by-weekday ```
displays a list of commits per weekday
-W, --commits-by-author-by-weekday For uninstalling, open up the cloned directory and run
displays a list of commits per weekday by author
-o, --commits-by-hour ```bash
displays a list of commits per hour sudo make uninstall
-A, --commits-by-author-by-hour ```
displays a list of commits per hour by author
-z, --commits-by-timezone For update/reinstall
displays a list of commits per timezone
-Z, --commits-by-author-by-timezone ```bash
displays a list of commits per timezone by author sudo make reinstall
```
CALENDAR OPTIONS
-k, --commits-calendar-by-author #### OS X (homebrew)
shows a calendar heatmap of commits per day-of-week per month for a given author
-H, --commits-heatmap ```bash
shows a heatmap of commits per day-of-week per month for the last 30 days brew install git-quick-stats
```
SUGGEST OPTIONS
-r, --suggest-reviewers #### Windows (cygwin)
show the best people to contact to review code
-h, -?, --help * [installer](https://gist.github.com/arzzen/35e09866dfdadf2108b2420045739245)
display this help text in the terminal * [uninstaller](https://gist.github.com/arzzen/21c660014d0663b6c5710014714779d6)
```
### Git log since and until ## System requirements
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. * Unix like OS with a proper shell
* Tools we use: awk ; cat ; column ; echo ; git ; grep ; head ; seq ; sort ; tput ; tr ; uniq ; wc
```bash
export _GIT_SINCE="2017-01-20" #### Dependences
export _GIT_UNTIL="2017-01-22"
``` * [`bsdmainutils`](https://packages.debian.org/sid/bsdmainutils) `apt install bsdmainutils`
Once set, run `git quick-stats` as normal. Note that this affects all stats that parse the git log history until unset. ## FAQ
### Git log limit *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`
You can set variable `_GIT_LIMIT` for limited output. It will affect the "changelogs" and "branch tree" options. The default limit is `10`. *A:* You can run dos2unix app in cygwin `/bin/dos2unix.exe /usr/local/bin/git-quick-stats`. This will convert it to Unix format and you then should be able to run it.
```bash ## Contribution
export _GIT_LIMIT=20
``` Want to contribute? Great! First, read this page.
### Git tag #### Code reviews
All submissions, including submissions by project members, require review.</br>
You can set `_GIT_TAG` to define the default tag used by the "new contributors since tag" option. We use Github pull requests for this purpose.
```bash #### Some tips for good pull requests:
export _GIT_TAG="foo" * Use our code </br>
``` 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
### Git log options 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)
You can set `_GIT_LOG_OPTIONS` for [git log options](https://git-scm.com/docs/git-log#_options): and [here](https://www.kernel.org/doc/Documentation/SubmittingPatches).
* If your PR consists of multiple commits which are successive improvements /
```bash fixes to your first commit, consider squashing them into a single commit
export _GIT_LOG_OPTIONS="--ignore-all-space --ignore-blank-lines" (`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.
### Git pathspec
#### Formatting
You can exclude a directory from the stats by using [pathspec](https://git-scm.com/docs/gitglossary#gitglossary-aiddefpathspecapathspec)
This documentation is written using standard [markdown syntax](https://help.github.com/articles/markdown-basics/). Please submit your changes using the same syntax.
```bash
export _GIT_PATHSPEC=':!directory' #### Tests
```
[![codecov](https://codecov.io/gh/arzzen/git-quick-stats/branch/master/graph/badge.svg)](https://codecov.io/gh/arzzen/git-quick-stats)
You can also exclude files from the stats. Note that it works with any alphanumeric, glob, or regex that git respects.
```bash
```bash make test
export _GIT_PATHSPEC=':!package-lock.json' ```
```
## Licensing
### Git merge view strategy MIT see [LICENSE][] for the full license text.
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. [read this page]: http://github.com/arzzen/git-quick-stats/blob/master/docs/CONTRIBUTING.md
[landing page]: http://arzzen.github.io/git-quick-stats
```bash [LICENSE]: https://github.com/arzzen/git-quick-stats/blob/master/LICENSE
export _GIT_MERGE_VIEW="enable"
export _GIT_MERGE_VIEW="exclusive"
```
### Git branch
You can set the variable `_GIT_BRANCH` to set the branch of the stats. Works with commands `--git-stats-by-branch` and `--csv-output-by-branch`.
```bash
export _GIT_BRANCH="master"
```
### Ignore authors
You can set the variable `_GIT_IGNORE_AUTHORS` to filter out specific authors. It will affect the "All contributors", ""Suggested code reviewers" and "New contributors" options.
```bash
export _GIT_IGNORE_AUTHORS="(author@examle.com|username)"
```
### Sorting contribution stats
You can sort contribution stats by field `name`, `commits`, `insertions`, `deletions`, or `lines` (total lines changed) and order (`asc`, `desc`). e.g.: `commits-desc`
```bash
export _GIT_SORT_BY="name-asc"
```
### Commit days
You can set \_GIT_DAYS to set the number of days for the heatmap
```bash
export _GIT_DAYS=30
```
### Color themes
You can change to the legacy color scheme by toggling the variable `_MENU_THEME` between `default` and `legacy`.
You can completely disable the color theme by setting the `_MENU_THEME` variable to `none`.
```bash
export _MENU_THEME="legacy"
# or
export _MENU_THEME="none"
```
![legacyThemeScreenshot](https://github.com/user-attachments/assets/3b319c1a-827f-47b8-bbfa-b8b59a39deef)
## Installation
### Debian and Ubuntu
If you are on at least Debian Bullseye or Ubuntu Focal you can use apt for installation:
```bash
apt install git-quick-stats
```
### UNIX and Linux
```bash
git clone https://github.com/git-quick-stats/git-quick-stats.git && cd git-quick-stats
sudo make install
```
For uninstalling, open up the cloned directory and run
```bash
sudo make uninstall
```
For update/reinstall
```bash
sudo make reinstall
```
### macOS (homebrew)
`git-quick-stats` requires GNU `date`. On macOS, install GNU coreutils:
```bash
brew install coreutils
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
```
The script auto-detects GNU date as either `date` or `gdate`, so exporting
`gnubin` is optional for this project.
From there, you can install via Homebrew as follows:
```bash
brew install git-quick-stats
```
Or you can follow the UNIX and Linux instructions if you wish.
If you would like to default to using GNU coreutils system-wide, add
`export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"` to your
applicable `~/.bash_profile`, `~/.zprofile`, or other relevant profile based
on the shell of your choice.
### FreeBSD
`git-quick-stats` requires GNU `date`. On FreeBSD, install GNU coreutils:
```bash
pkg install coreutils
```
FreeBSD provides GNU date as `gdate`, and the script auto-detects it.
### Windows
If you are installing with Cygwin, use these scripts:
- [installer](https://gist.github.com/arzzen/35e09866dfdadf2108b2420045739245)
- [uninstaller](https://gist.github.com/arzzen/21c660014d0663b6c5710014714779d6)
If you are wishing to use this with WSL, follow the UNIX and Linux instructions.
### Docker
You can use the Docker image provided:
- Build: `docker build -t arzzen/git-quick-stats .`
- Run interactive menu: `docker run --rm -it -v $(pwd):/git arzzen/git-quick-stats`
- Docker pull command: `docker pull arzzen/git-quick-stats` [docker repository](https://hub.docker.com/r/arzzen/git-quick-stats)
## System requirements
- An OS with a Bash shell
- GNU `date` available as either `date` or `gdate`
- Tools we use:
```bash
awk
basename
cat
column
date
echo
git
grep
head
printf
seq
sort
tput
tr
uniq
```
### Dependencies
- [`bsdextrautils`](https://packages.debian.org/sid/bsdextrautils) `apt install bsdextrautils`
- [`coreutils`](https://packages.debian.org/sid/coreutils) `apt install coreutils`
- [`gawk`](https://packages.debian.org/sid/gawk) `apt install gawk`
- [`grep`](https://packages.debian.org/sid/grep) `apt install grep`
- [`ncurses-bin`](https://packages.debian.org/sid/ncurses-bin) `apt install ncurses-bin`
## FAQ
_Q:_ I get some errors after run git-quick-stats in cygwin like `/usr/local/bin/git-quick-stats: line 2: $'\r': command not found`
_A:_ You can run the dos2unix app in cygwin as follows: `/bin/dos2unix.exe /usr/local/bin/git-quick-stats`. This will convert the script from the CR-LF convention that Microsoft uses to the LF convention that UNIX, OS X, and Linux use. You should then should be able to run it as normal.
_Q:_ How they could be used in a project with many git projects and statistics would show a summary of all git projects?
_A:_ If you want to include submodule logs, you can try using the following: `export _GIT_LOG_OPTIONS="-p --submodule=log"`
(more info about [git log --submodule](https://git-scm.com/docs/git-log#Documentation/git-log.txt---submoduleltformatgt))
## Contribution
Want to contribute? Great! First, read this page.
### Code reviews
All submissions, including submissions by project members, require review.</br>
We use GitHub pull requests for this purpose.
### Some tips for good pull requests
- Use our code </br>
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)

BIN
docs/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

6
docs/css/animate.min.css vendored Normal file

File diff suppressed because one or more lines are too long

5
docs/css/bootstrap.min.css vendored Normal file

File diff suppressed because one or more lines are too long

509
docs/css/creative.css Normal file
View file

@ -0,0 +1,509 @@
/*!
* Start Bootstrap - Creative Bootstrap Theme (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
html,
body {
width: 100%;
height: 100%;
}
body {
font-family: Merriweather,'Helvetica Neue',Arial,sans-serif;
}
hr {
max-width: 50px;
border-color: #f05f40;
border-width: 3px;
}
hr.light {
border-color: #fff;
}
a {
color: #f05f40;
-webkit-transition: all .35s;
-moz-transition: all .35s;
transition: all .35s;
}
a:hover,
a:focus {
color: #eb3812;
}
#about a {
color: rgba(52, 52, 52, .7);
}
#about a:hover,
#about a:focus {
color: rgb(52, 52, 52);
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;
}
p {
margin-bottom: 20px;
font-size: 16px;
line-height: 1.5;
}
.bg-primary {
background-color: #f05f40;
}
.bg-dark {
color: #fff;
background-color: #222;
}
.text-faded {
color: rgba(255,255,255,.7);
}
section {
padding: 100px 0;
}
aside {
padding: 50px 0;
}
.no-padding {
padding: 0;
}
.navbar-default {
border-color: rgba(34,34,34,.05);
font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;
background-color: #fff;
-webkit-transition: all .35s;
-moz-transition: all .35s;
transition: all .35s;
}
.navbar-default .navbar-header .navbar-brand {
text-transform: uppercase;
font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;
font-weight: 700;
color: #2d8888;
}
.navbar-default .navbar-header .navbar-brand:hover,
.navbar-default .navbar-header .navbar-brand:focus {
color: #eb3812;
}
.navbar-default .nav > li>a,
.navbar-default .nav>li>a:focus {
text-transform: uppercase;
font-size: 13px;
font-weight: 700;
color: #222;
}
.navbar-default .nav > li>a:hover,
.navbar-default .nav>li>a:focus:hover {
color: #f05f40;
}
.navbar-default .nav > li.active>a,
.navbar-default .nav>li.active>a:focus {
color: #f05f40!important;
background-color: transparent;
}
.navbar-default .nav > li.active>a:hover,
.navbar-default .nav>li.active>a:focus:hover {
background-color: transparent;
}
@media(min-width:768px) {
.navbar-default {
border-color: rgba(255,255,255,.3);
background-color: transparent;
}
.navbar-default .navbar-header .navbar-brand {
color: rgba(255,255,255,.7);
}
.navbar-default .navbar-header .navbar-brand:hover,
.navbar-default .navbar-header .navbar-brand:focus {
color: #fff;
}
.navbar-default .nav > li>a,
.navbar-default .nav>li>a:focus {
color: rgba(255,255,255,.7);
}
.navbar-default .nav > li>a:hover,
.navbar-default .nav>li>a:focus:hover {
color: #fff;
}
.navbar-default.affix {
border-color: rgba(34,34,34,.05);
background-color: #fff;
}
.navbar-default.affix .navbar-header .navbar-brand {
font-size: 14px;
color: #f05f40;
}
.navbar-default.affix .navbar-header .navbar-brand:hover,
.navbar-default.affix .navbar-header .navbar-brand:focus {
color: #eb3812;
}
.navbar-default.affix .nav > li>a,
.navbar-default.affix .nav>li>a:focus {
color: #222;
}
.navbar-default.affix .nav > li>a:hover,
.navbar-default.affix .nav>li>a:focus:hover {
color: #f05f40;
}
}
header {
position: relative;
width: 100%;
min-height: auto;
text-align: center;
color: #fff;
background-color: #2f2d2f;
/*background-color: #2c3333;*/
/*background-image: url(../img/header.jpg);*/
/*background-position: center;*/
/*-webkit-background-size: cover;*/
/*-moz-background-size: cover;*/
/*background-size: cover;*/
/*-o-background-size: cover;*/
}
header .header-content {
position: relative;
width: 100%;
padding: 100px 15px;
text-align: center;
}
header .header-content .header-content-inner h1 {
margin-top: 0;
margin-bottom: 0;
/* text-transform: uppercase; */
font-weight: 700;
font-size: 120px;
}
header .header-content .header-content-inner hr {
margin: 30px auto;
}
header .header-content .header-content-inner p {
margin-bottom: 50px;
font-size: 16px;
font-weight: 300;
color: rgba(255,255,255,.7);
}
@media(min-width:768px) {
header {
min-height: 100%;
}
header .header-content {
position: absolute;
top: 50%;
padding: 0 50px;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
header .header-content .header-content-inner {
margin-right: auto;
margin-left: auto;
max-width: 1000px;
}
header .header-content .header-content-inner p {
margin-right: auto;
margin-left: auto;
max-width: 80%;
font-size: 18px;
}
}
.section-heading {
margin-top: 0;
}
.service-box {
margin: 50px auto 0;
max-width: 400px;
}
@media(min-width:992px) {
.service-box {
margin: 20px auto 0;
}
}
.service-box p {
margin-bottom: 0;
}
.portfolio-box {
display: block;
position: relative;
margin: 0 auto;
max-width: 650px;
}
.portfolio-box .portfolio-box-caption {
display: block;
position: absolute;
bottom: 0;
width: 100%;
height: 100%;
text-align: center;
color: #fff;
opacity: 0;
background: rgba(240,95,64,.9);
-webkit-transition: all .35s;
-moz-transition: all .35s;
transition: all .35s;
}
.portfolio-box .portfolio-box-caption .portfolio-box-caption-content {
position: absolute;
top: 50%;
width: 100%;
text-align: center;
transform: translateY(-50%);
}
.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-category,
.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-name {
padding: 0 15px;
font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;
}
.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-category {
text-transform: uppercase;
font-size: 14px;
font-weight: 600;
}
.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-name {
font-size: 18px;
}
.portfolio-box:hover .portfolio-box-caption {
opacity: 1;
}
@media(min-width:768px) {
.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-category {
font-size: 16px;
}
.portfolio-box .portfolio-box-caption .portfolio-box-caption-content .project-name {
font-size: 22px;
}
}
.call-to-action h2 {
margin: 0 auto 20px;
}
.text-primary {
color: #f05f40;
}
.no-gutter > [class*=col-] {
padding-right: 0;
padding-left: 0;
}
.btn-default {
border-color: #fff;
color: #222;
background-color: #fff;
-webkit-transition: all .35s;
-moz-transition: all .35s;
transition: all .35s;
}
.btn-default:hover,
.btn-default:focus,
.btn-default.focus,
.btn-default:active,
.btn-default.active,
.open > .dropdown-toggle.btn-default {
border-color: #ededed;
color: #222;
background-color: #f2f2f2;
}
.btn-default:active,
.btn-default.active,
.open > .dropdown-toggle.btn-default {
background-image: none;
}
.btn-default.disabled,
.btn-default[disabled],
fieldset[disabled] .btn-default,
.btn-default.disabled:hover,
.btn-default[disabled]:hover,
fieldset[disabled] .btn-default:hover,
.btn-default.disabled:focus,
.btn-default[disabled]:focus,
fieldset[disabled] .btn-default:focus,
.btn-default.disabled.focus,
.btn-default[disabled].focus,
fieldset[disabled] .btn-default.focus,
.btn-default.disabled:active,
.btn-default[disabled]:active,
fieldset[disabled] .btn-default:active,
.btn-default.disabled.active,
.btn-default[disabled].active,
fieldset[disabled] .btn-default.active {
border-color: #fff;
background-color: #fff;
}
.btn-default .badge {
color: #fff;
background-color: #222;
}
.btn-primary {
border-color: #f05f40;
color: #fff;
background-color: #2d8888;
-webkit-transition: all .35s;
-moz-transition: all .35s;
transition: all .35s;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary.focus,
.btn-primary:active,
.btn-primary.active,
.open > .dropdown-toggle.btn-primary {
color: #fff;
background-color: #68a9a9;
}
.btn-primary:active,
.btn-primary.active,
.open > .dropdown-toggle.btn-primary {
background-image: none;
}
.btn-primary.disabled,
.btn-primary[disabled],
fieldset[disabled] .btn-primary,
.btn-primary.disabled:hover,
.btn-primary[disabled]:hover,
fieldset[disabled] .btn-primary:hover,
.btn-primary.disabled:focus,
.btn-primary[disabled]:focus,
fieldset[disabled] .btn-primary:focus,
.btn-primary.disabled.focus,
.btn-primary[disabled].focus,
fieldset[disabled] .btn-primary.focus,
.btn-primary.disabled:active,
.btn-primary[disabled]:active,
fieldset[disabled] .btn-primary:active,
.btn-primary.disabled.active,
.btn-primary[disabled].active,
fieldset[disabled] .btn-primary.active {
border-color: #f05f40;
background-color: #f05f40;
}
.btn-primary .badge {
color: #f05f40;
background-color: #fff;
}
.btn {
border: 0;
border-radius: 300px;
text-transform: uppercase;
font-family: 'Open Sans','Helvetica Neue',Arial,sans-serif;
font-weight: 700;
font-size: 1.4em;
}
.btn-xl {
padding: 15px 30px;
}
::-moz-selection {
text-shadow: none;
color: #fff;
background: #222;
}
::selection {
text-shadow: none;
color: #fff;
background: #222;
}
img::selection {
color: #fff;
background: 0 0;
}
img::-moz-selection {
color: #fff;
background: 0 0;
}
body {
webkit-tap-highlight-color: #222;
}
#map {
height: 300px;
overflow: visible;
position: relative;
}
.subtitle {
color: #b1b1b1;
}
.logo {
width: 50%;
padding-bottom: 5px;
}
.screencap {
width: 80%;
padding-top: 20px;
padding-bottom: 30px;
}

81
docs/css/modals.css Normal file
View file

@ -0,0 +1,81 @@
/*!
* The code below adds the modal functionality of the Freelancer Bootstrap Theme
* and was originally part of this theme.
*
*
* Start Bootstrap - Freelancer Bootstrap Theme (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
body {
overflow-x: hidden;
}
.img-centered {
margin: 0 auto;
}
.portfolio-modal .modal-content {
padding: 100px 0;
min-height: 100%;
border: 0;
border-radius: 0;
text-align: center;
background-clip: border-box;
-webkit-box-shadow: none;
box-shadow: none;
}
.portfolio-modal .modal-content h2 {
margin: 0;
font-size: 3em;
}
.portfolio-modal .modal-content img {
margin-bottom: 30px;
}
.portfolio-modal .modal-content .item-details {
margin: 30px 0;
}
.portfolio-modal .close-modal {
position: absolute;
top: 25px;
right: 25px;
width: 75px;
height: 75px;
background-color: transparent;
cursor: pointer;
}
.portfolio-modal .close-modal:hover {
opacity: .3;
}
.portfolio-modal .close-modal .lr {
z-index: 1051;
width: 1px;
height: 75px;
margin-left: 35px;
background-color: #2c3e50;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.portfolio-modal .close-modal .lr .rl {
z-index: 1052;
width: 1px;
height: 75px;
background-color: #2c3e50;
-webkit-transform: rotate(90deg);
-ms-transform: rotate(90deg);
transform: rotate(90deg);
}
.portfolio-modal .modal-backdrop {
display: none;
opacity: 0;
}

BIN
docs/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

35
docs/index.html Normal file
View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Lukas Mestan">
<meta name="description" content="Commandline GIT statistics">
<title>git quick stats</title>
<link rel="shortcut icon" href="favicon.ico?v=1" type="image/x-icon">
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<link rel="stylesheet" href="css/animate.min.css" type="text/css">
<link rel="stylesheet" href="css/creative.css" type="text/css">
<link rel="stylesheet" href="css/modals.css" type="text/css">
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<meta http-equiv="refresh" content="0;url=https://lukasmestan.com/git-quick-stats/">
</head>
<body id="page-top">
<header>
<div class="header-content">
<div class="header-content-inner">
<h1>git quick stats</h1>
<h3 class="subtitle"> simple and efficient way to access various statistics in git repository</h3>
<img class="screencap" src="bg.png" \>
<br>
<a href="https://github.com/arzzen/git-quick-stats" class="btn btn-primary btn-xl page-scroll">download</a>
</div>
</div>
</header>
</body>
</html>

File diff suppressed because it is too large Load diff

View file

@ -1,233 +1,113 @@
.TH git-quick-stats "1" "June 2025" "git-quick-stats" "User Commands" .TH git-quick-stats "1" "January 2019" "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 OPTIONS
.PP .HP
git-quick-stats requires GNU date support for date parsing options. \fB\-r\fR, \fB\-\-suggest\-reviewers\fR
.PP .IP
On macOS, install GNU coreutils with: show the best people to contact to review code
.PP .HP
.B brew install coreutils .PP
.PP .PP
On FreeBSD, install GNU coreutils with: \fB\-T\fR, \fB\-\-detailed\-git\-stats\fR
.PP .IP
.B pkg install coreutils give a detailed list of git stats
.PP .HP
GNU date may be available as either .PP
.B date \fB\-d\fR, \fB\-\-commits\-per\-day\fR
or .IP
.B gdate displays a list of commits per day
and git-quick-stats auto-detects both. .HP
.PP .PP
.SH GENERATE OPTIONS \fB\-m\fR, \fB\-\-commits\-by\-month\fR
.PP .IP
\fB\-h\fR, \-?, \fB\-\-help\fR displays a list of commits per month
.IP .HP
display this help text in the terminal .PP
.PP \fB\-w\fR, \fB\-\-commits\-by\-weekday\fR
\fB\-T\fR, \fB\-\-detailed\-git\-stats\fR .IP
.IP displays a list of commits per weekday
give a detailed list of git stats .HP
.HP .PP
.PP \fB\-o\fR, \fB\-\-commits\-by\-hour\fR
\fB\-R\fR, \fB\-\-git\-stats\-by\-branch\fR .IP
.IP displays a list of commits per hour
see detailed list of git stats by branch .HP
.HP .PP
.PP \fB\-A\fR, \fB\-\-commits\-by\-author\-by\-hour\fR
\fB\-c\fR, \fB\-\-changelogs\fR .IP
.IP displays a list of commits per hour by author
see changelogs .HP
.HP .PP
.PP \fB\-a\fR, \fB\-\-commits\-per\-author\fR
\fB\-L\fR, \fB\-\-changelogs\-by\-author\fR .IP
.IP displays a list of commits per author
see changelogs by author .HP
.HP .PP
.PP \fB\-S\fR, \fB\-\-my\-daily\-stats\fR
\fB\-S\fR, \fB\-\-my\-daily\-stats\fR .IP
.IP see your current daily stats
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\-b\fR, \fB\-\-branch\-tree\fR
\fB\-j\fR, \fB\-\-json\-output\fR .IP
.IP show an ASCII graph of the git repo branch history
save git log as a JSON formatted file to a specified area .HP
.HP .PP
.SH LIST OPTIONS \fB\-D\fR, \fB\-\-branches\-by\-date\fR
.PP .IP
\fB\-b\fR, \fB\-\-branch\-tree\fR show branches by date
.IP .HP
show an ASCII graph of the git repo branch history .PP
.HP \fB\-c\fR, \fB\-\-changelogs\fR
.PP .IP
\fB\-D\fR, \fB\-\-branches\-by\-date\fR see changelogs
.IP .HP
show branches by date .PP
.HP \fB\-L\fR, \fB\-\-changelogs\-by\-author\fR
.PP .IP
\fB\-C\fR, \fB\-\-contributors\fR see changelogs by author
.IP .HP
see a list of everyone who contributed to the repo .PP
.HP \fB\-h\fR, \-?, \fB\-\-help\fR
.PP .IP
\fB\-n\fR, \fB\-\-new\-contributors\fR display this help text in the terminal
.IP .PP
list everyone who made their first contribution since a specified date .SH ADDITIONAL USAGE
.HP You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log, example:
.PP .IP
\fB\-N\fR, \fB\-\-new\-contributors\-since\-tag\fR .PP
.IP .B export _GIT_SINCE="2017\-20\-01"
list everyone who made their first contribution since a specified git tag .IP
.HP .PP
.PP You can set _GIT_LIMIT for limited output log, example:
\fB\-a\fR, \fB\-\-commits\-per\-author\fR .PP
.IP .B export _GIT_LIMIT=20
displays a list of commits per author .PP
.HP You can exclude a directory from the stats by using pathspec, example:
.PP .PP
\fB\-d\fR, \fB\-\-commits\-per\-day\fR .B export _GIT_PATHSPEC=':!directory'
.IP .
displays a list of commits per day .fi
.HP
.PP
\fB\-m\fR, \fB\-\-commits\-by\-month\fR
.IP
displays a list of commits per month
.HP
.PP
\fB\-Y\fR, \fB\-\-commits\-by\-year\fR
.IP
displays a list of commits per year
.HP
.PP
\fB\-w\fR, \fB\-\-commits\-by\-weekday\fR
.IP
displays a list of commits per weekday
.HP
.PP
\fB\-W\fR, \fB\-\-commits\-by\-author\-by\-weekday\fR
.IP
displays a list of commits per weekday by author
.HP
.PP
\fB\-o\fR, \fB\-\-commits\-by\-hour\fR
.IP
displays a list of commits per hour
.HP
.PP
\fB\-A\fR, \fB\-\-commits\-by\-author\-by\-hour\fR
.IP
displays a list of commits per hour by author
.HP
.PP
\fB\-z\fR, \fB\-\-commits\-by\-timezone\fR
.IP
displays a list of commits per timezone
.HP
.PP
\fB\-Z\fR, \fB\-\-commits\-by\-author\-by\-timezone\fR
.IP
displays a list of commits per timezone by author
.HP
.PP
\fB\-\-activity\-calendar\fR
.IP
displays a calendar-style grid of commit activity per day-of-week and month for a selected author.
.HP
.SH SUGGEST OPTIONS
.PP
\fB\-r\fR, \fB\-\-suggest\-reviewers\fR
.IP
show the best people to contact to review code
.HP
.PP
.SH CALENDAR OPTIONS
.PP
\fB\-k\fR, \fB\-\-commits\-calendar\-by\-author\fR outputs a visual grid of commit activity for a selected author, grouped by day-of-week (rows: Mon..Sun) and month (columns: Jan..Dec). Each cell is 3 characters wide, separated by one space.
.PP
.PP
\fB\-H\fR, \fB\-\-commits\-heatmap\fR shows a heatmap of commits per day per hour for the last 30 days
.PP
.SH ADDITIONAL USAGE
You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log, example:
.PP
.B export _GIT_SINCE="2017\-01\-20"
.PP
You can set _GIT_LIMIT for limited output log, example:
.PP
.B export _GIT_LIMIT=20
.PP
You can set _GIT_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

@ -17,16 +17,12 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
set -o nounset
export DISCOVERONLY=${DISCOVERONLY:-} export DISCOVERONLY=${DISCOVERONLY:-}
export DEBUG=${DEBUG:-} export DEBUG=${DEBUG:-}
export STOP=${STOP:-} export STOP=${STOP:-}
export INVARIANT=${INVARIANT:-} export INVARIANT=${INVARIANT:-}
export CONTINUE=${CONTINUE:-} export CONTINUE=${CONTINUE:-}
GREP=${GREP:-grep}
args="$(getopt -n "$0" -l \ args="$(getopt -n "$0" -l \
verbose,help,stop,discover,invariant,continue vhxdic $*)" \ verbose,help,stop,discover,invariant,continue vhxdic $*)" \
|| exit -1 || exit -1
@ -79,7 +75,7 @@ assert_end() {
tests_endtime="$(date +%s%N)" tests_endtime="$(date +%s%N)"
# required visible decimal place for seconds (leading zeros if needed) # required visible decimal place for seconds (leading zeros if needed)
local tests_time="$( \ local tests_time="$( \
printf "%010d" "$(( ${tests_endtime/%N/000000000} printf "%010d" "$(( ${tests_endtime/%N/000000000}
- ${tests_starttime/%N/000000000} ))")" # in ns - ${tests_starttime/%N/000000000} ))")" # in ns
tests="$tests_ran ${*:+$* }tests" tests="$tests_ran ${*:+$* }tests"
[[ -n "$DISCOVERONLY" ]] && echo "collected $tests." && _assert_reset && return [[ -n "$DISCOVERONLY" ]] && echo "collected $tests." && _assert_reset && return
@ -105,7 +101,7 @@ assert_end() {
assert() { assert() {
# assert <command> <expected stdout> [stdin] # assert <command> <expected stdout> [stdin]
(( tests_ran++ )) || : (( tests_ran++ )) || :
[[ -z "$DISCOVERONLY" ]] || return 0 [[ -z "$DISCOVERONLY" ]] || return
expected=$(echo -ne "${2:-}") expected=$(echo -ne "${2:-}")
result="$(eval 2>/dev/null $1 <<< ${3:-})" || true result="$(eval 2>/dev/null $1 <<< ${3:-})" || true
if [[ "$result" == "$expected" ]]; then if [[ "$result" == "$expected" ]]; then
@ -115,13 +111,13 @@ assert() {
result="$(sed -e :a -e '$!N;s/\n/\\n/;ta' <<< "$result")" result="$(sed -e :a -e '$!N;s/\n/\\n/;ta' <<< "$result")"
[[ -z "$result" ]] && result="nothing" || result="\"$result\"" [[ -z "$result" ]] && result="nothing" || result="\"$result\""
[[ -z "$2" ]] && expected="nothing" || expected="\"$2\"" [[ -z "$2" ]] && expected="nothing" || expected="\"$2\""
_assert_fail "expected $expected${_indent}got $result" "$1" "${3:-}" _assert_fail "expected $expected${_indent}got $result" "$1" "$3"
} }
assert_raises() { assert_raises() {
# assert_raises <command> <expected code> [stdin] # assert_raises <command> <expected code> [stdin]
(( tests_ran++ )) || : (( tests_ran++ )) || :
[[ -z "$DISCOVERONLY" ]] || return 0 [[ -z "$DISCOVERONLY" ]] || return
status=0 status=0
(eval $1 <<< ${3:-}) > /dev/null 2>&1 || status=$? (eval $1 <<< ${3:-}) > /dev/null 2>&1 || status=$?
expected=${2:-0} expected=${2:-0}
@ -129,24 +125,19 @@ assert_raises() {
[[ -z "$DEBUG" ]] || echo -n . [[ -z "$DEBUG" ]] || echo -n .
return return
fi fi
_assert_fail "program terminated with code $status instead of $expected" "$1" "${3:-}" _assert_fail "program terminated with code $status instead of $expected" "$1" "$3"
}
assert_success() {
# assert_success <command>
assert_raises "$1" 0
} }
# _assert_with_grep <grep modifiers> <command> <expected output...> # _assert_with_grep <grep modifiers> <command> <expected output...>
_assert_with_grep() { _assert_with_grep() {
local grep_modifier="$1" local grep_modifier="$1"
local output="$($2)" local output="$($2)"
local exitcode=0 local exitcode="$4" || 0
shift 2 shift 2
while [ $# != 0 ]; do while [ $# != 0 ]; do
assert_raises "echo '$output' | $GREP $grep_modifier '$1'" $exitcode || return 1 assert_raises "echo '$output' | $GREP $grep_modifier '$1'" $exitcode || return 1
shift shift
done done
} }

View file

@ -1,138 +1,19 @@
#!/bin/bash #!/bin/bash
# Verify we are in a git repo. Create one if not
# FIXME: All the paths are hardcoded currently and will break if anything
# in this chain moves or gets executed elsewhere. Adjust all of these so
# pathing does not matter as much such as creating a TOP variable that
# does something like TOP=$(cd "$(dirname "$0")" || exit ; pwd -P)
# or maybe leverages Make to handle these as test targets
./tests/test-git/resetgit
. 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\n\nNAME\n git-quick-stats - Simple and efficient way to access various stats in a git repo\n\nSYNOPSIS\n For non-interactive mode: git-quick-stats [OPTIONS]\n For interactive mode: git-quick-stats\n\nDESCRIPTION\n Any git repository contains tons of information about commits, contributors,\n and files. Extracting this information is not always trivial, mostly because\n of a gadzillion options to a gadzillion git commands.\n\n This program allows you to see detailed information about a git repository.\n\nOPTIONS\n suggestReviewers - see best people to contact to review code\n detailedGitStats - displays a detailed list of git status\n commitsPerDay - displays a list of commits per day\n commitsByMonth - displays a list of commits per month\n commitsByWeekday - displays a list of commits per weekday\n commitsByHour - displays a list of commits per hour\n commitsByAuthorByHour - see a list of commits per hour by author\n commitsPerAuthor - displays a list of commits per author\n myDailyStats - see your current daily stats\n contributors - see a list of all contributors\n branchTree - see an ASCII graph of the git repo\n branchesByDate - show branches by date\n changelogs - see changelogs\n changelogsByAuthor - see changelogs by author\n\nADDITIONAL USAGE\n You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log\n ex: export _GIT_SINCE=2017-20-01\n You can set _GIT_LIMIT for limited output log\n ex: export _GIT_LIMIT=20\n You can exclude a directory from the stats by using pathspec\n ex: export _GIT_PATHSPEC=':!directory'\n \nCONTRIBUTION\n For details regarding contribution, please see the contribution.md document\n\nLICENSE\n This is under the MIT license. See LICENSE in the repo for more info"
assert "$src fail" "Invalid argument\n\nNAME\n git-quick-stats - Simple and efficient way to access various stats in a git repo\n\nSYNOPSIS\n For non-interactive mode: git-quick-stats [OPTIONS]\n For interactive mode: git-quick-stats\n\nDESCRIPTION\n Any git repository contains tons of information about commits, contributors,\n and files. Extracting this information is not always trivial, mostly because\n of a gadzillion options to a gadzillion git commands.\n\n This program allows you to see detailed information about a git repository.\n\nOPTIONS\n -r, --suggest-reviewers\n show the best people to contact to review code\n -T, --detailed-git-stats\n give a detailed list of git stats\n -d, --commits-per-day\n displays a list of commits per day\n -m, --commits-by-month\n displays a list of commits per month\n -w, --commits-by-weekday\n displays a list of commits per weekday\n -o, --commits-by-hour\n displays a list of commits per hour\n -A, --commits-by-author-by-hour\n displays a list of commits per hour by author\n -a, --commits-per-author\n displays a list of commits per author\n -S, --my-daily-stats\n see your current daily stats\n -C, --contributors\n see a list of everyone who contributed to the repo\n -b, --branch-tree\n show an ASCII graph of the git repo branch history\n -D, --branches-by-date\n show branches by date\n -c, --changelogs\n see changelogs\n -L, --changelogs-by-author\n see changelogs by author\n -h, -?, --help\n display this help text in the terminal\n\nADDITIONAL USAGE\n You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log\n ex: export _GIT_SINCE=\"2017-20-01\"\n You can set _GIT_LIMIT for limited output log\n ex: export _GIT_LIMIT=20\n You can exclude a directory from the stats by using pathspec\n ex: export _GIT_PATHSPEC=':!directory'"
NAME
git-quick-stats - Simple and efficient way to access various stats in a git repo
SYNOPSIS
For non-interactive mode: git-quick-stats [OPTIONS]
For interactive mode: git-quick-stats
DESCRIPTION
Any git repository contains tons of information about commits, contributors,
and files. Extracting this information is not always trivial, mostly because
of a gadzillion options to a gadzillion git commands.
This program allows you to see detailed information about a git repository.
GENERATE OPTIONS
-T, --detailed-git-stats
give a detailed list of git stats
-R, --git-stats-by-branch
see detailed list of git stats by branch
-c, --changelogs
see changelogs
-L, --changelogs-by-author
see changelogs by author
-S, --my-daily-stats
see your current daily stats
-V, --csv-output-by-branch
output daily stats by branch in CSV format
-j, --json-output
save git log as a JSON formatted file to a specified area
LIST OPTIONS
-b, --branch-tree
show an ASCII graph of the git repo branch history
-D, --branches-by-date
show branches by date
-C, --contributors
see a list of everyone who contributed to the repo
-n, --new-contributors
list everyone who made their first contribution since a specified date
-N, --new-contributors-since-tag
list everyone who made their first contribution since a specified tag
-a, --commits-per-author
displays a list of commits per author
-d, --commits-per-day
displays a list of commits per day
-m, --commits-by-month
displays a list of commits per month
-Y, --commits-by-year
displays a list of commits per year
-w, --commits-by-weekday
displays a list of commits per weekday
-W, --commits-by-author-by-weekday
displays a list of commits per weekday by author
-o, --commits-by-hour
displays a list of commits per hour
-A, --commits-by-author-by-hour
displays a list of commits per hour by author
-z, --commits-by-timezone
displays a list of commits per timezone
-Z, --commits-by-author-by-timezone
displays a list of commits per timezone by author
CALENDAR OPTIONS
-k, --commits-calendar-by-author
shows a calendar heatmap of commits per day-of-week per month for a given author
-H, --commits-heatmap
shows a heatmap of commits per day-of-week per month for the last 30 days
SUGGEST OPTIONS
-r, --suggest-reviewers
show the best people to contact to review code
-h, -?, --help
display this help text in the terminal
ADDITIONAL USAGE
You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log
ex: export _GIT_SINCE=\"2017-01-20\"
You can set _GIT_LIMIT for limited output log
ex: export _GIT_LIMIT=20
You can set _GIT_LOG_OPTIONS for git log options
ex: export _GIT_LOG_OPTIONS=\"--ignore-all-space --ignore-blank-lines\"
You can exclude directories or files from the stats by using pathspec
ex: export _GIT_PATHSPEC=':!pattern'
You can set _GIT_MERGE_VIEW to view merge commits with normal commits
ex: export _GIT_MERGE_VIEW=enable
You can also set _GIT_MERGE_VIEW to only show merge commits
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 completely disable the color theme by setting the \"_MENU_THEME\" variable to \"none\".
ex: export _MENU_THEME=legacy
You can set _GIT_BRANCH to set the branch of the stats
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)" 127
assert_success "$src --suggest-reviewers" assert_raises "$src --suggest-reviewers" 0
assert_contains "$src --detailed-git-stats" "Contribution stats (by author) on the current branch" assert_contains "$src --detailed-git-stats" "Contribution stats" 127
assert_success "$src --detailed-git-stats" assert_raises "$src --detailed-git-stats" 0
assert_contains "$src --commits-per-day" "Git commits per date" assert_contains "$src --commits-per-day" "Git commits per date" 127
assert_success "$src --commits-per-day" assert_raises "$src --commits-per-day" 0
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_success "$src --commits-by-year"
export LC_TIME=POSIX
assert_startswith "$src --commits-by-year" "Git commits by year"
assert_success "$src --commits-by-year"
assert_end assert_end

View file

@ -1,16 +0,0 @@
#!/bin/sh
# Initialises a new local Git repo for test purpose if one does not exist already
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
{
git init
git config user.name "$(printf %s 'Test Git,\nfor test purpose')"
git config user.email "TestGit\o/@example.org"
printf 'test-git\n========\n' > README.md
git add README.md
git commit -m 'added readme (o\w/o)' -m 'in markdown, no \r\n, only \n' -m 'a very "simple" readme'
testChars="$(printf 'tab [%b] form feed [%b] line feed [%b] carriage return [%b]' '\x09' '\x0C' '\x0A' '\x0D')"
git notes add -m 'Some notes' -m 'out of ascii: été au cœur' -m "$testChars"
git log
} >/dev/null 2>&1
fi