mirror of
https://github.com/git-quick-stats/git-quick-stats.git
synced 2025-12-16 12:00:12 +01:00
Merge branch 'master' into feat/activity-calendar
This commit is contained in:
4
Makefile
4
Makefile
@@ -30,8 +30,8 @@ uninstall:
|
|||||||
@$(TASK_DONE)
|
@$(TASK_DONE)
|
||||||
|
|
||||||
reinstall:
|
reinstall:
|
||||||
@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
|
||||||
@curl -sO https://raw.githubusercontent.com/arzzen/git-quick-stats/master/git-quick-stats.1
|
@curl -sO https://raw.githubusercontent.com/git-quick-stats/git-quick-stats/master/git-quick-stats.1
|
||||||
$(MAKE) install
|
$(MAKE) install
|
||||||
@$(TASK_DONE)
|
@$(TASK_DONE)
|
||||||
|
|
||||||
|
|||||||
94
README.md
94
README.md
@@ -1,6 +1,6 @@
|
|||||||
# GIT quick statistics [](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 [](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)
|
||||||
|
|
||||||
[](#backers) [](#sponsors) [](https://formulae.brew.sh/formula/git-quick-stats#default)
|
[](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.
|
||||||
>
|
>
|
||||||
@@ -14,34 +14,34 @@
|
|||||||
|
|
||||||
[**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)
|
||||||
|
|
||||||
@@ -49,8 +49,8 @@
|
|||||||
|
|
||||||
[**Contributors**](#contributors)
|
[**Contributors**](#contributors)
|
||||||
|
|
||||||
* [**Backers**](#backers)
|
- [**Backers**](#backers)
|
||||||
* [**Sponsors**](#sponsors)
|
- [**Sponsors**](#sponsors)
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
@@ -204,6 +204,12 @@ You can set the variable `_GIT_BRANCH` to set the branch of the stats. Works wit
|
|||||||
export _GIT_BRANCH="master"
|
export _GIT_BRANCH="master"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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)"
|
||||||
|
```
|
||||||
|
|
||||||
### Color themes
|
### Color themes
|
||||||
|
|
||||||
You can change to the legacy color scheme by toggling the variable `_MENU_THEME` between `default` and `legacy`
|
You can change to the legacy color scheme by toggling the variable `_MENU_THEME` between `default` and `legacy`
|
||||||
@@ -227,7 +233,7 @@ apt install git-quick-stats
|
|||||||
### UNIX and Linux
|
### UNIX and Linux
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/arzzen/git-quick-stats.git && cd git-quick-stats
|
git clone https://github.com/git-quick-stats/git-quick-stats.git && cd git-quick-stats
|
||||||
sudo make install
|
sudo make install
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -271,8 +277,8 @@ based on the shell of your choice.
|
|||||||
|
|
||||||
If you are installing with Cygwin, use these scripts:
|
If you are installing with Cygwin, use these scripts:
|
||||||
|
|
||||||
* [installer](https://gist.github.com/arzzen/35e09866dfdadf2108b2420045739245)
|
- [installer](https://gist.github.com/arzzen/35e09866dfdadf2108b2420045739245)
|
||||||
* [uninstaller](https://gist.github.com/arzzen/21c660014d0663b6c5710014714779d6)
|
- [uninstaller](https://gist.github.com/arzzen/21c660014d0663b6c5710014714779d6)
|
||||||
|
|
||||||
If you are wishing to use this with WSL, follow the UNIX and Linux instructions.
|
If you are wishing to use this with WSL, follow the UNIX and Linux instructions.
|
||||||
|
|
||||||
@@ -280,14 +286,14 @@ If you are wishing to use this with WSL, follow the UNIX and Linux instructions.
|
|||||||
|
|
||||||
You can use the Docker image provided:
|
You can use the Docker image provided:
|
||||||
|
|
||||||
* Build: `docker build -t arzzen/git-quick-stats .`
|
- Build: `docker build -t arzzen/git-quick-stats .`
|
||||||
* Run interactive menu: `docker run --rm -it -v $(pwd):/git arzzen/git-quick-stats`
|
- 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)
|
- Docker pull command: `docker pull arzzen/git-quick-stats` [docker repository](https://hub.docker.com/r/arzzen/git-quick-stats)
|
||||||
|
|
||||||
## System requirements
|
## System requirements
|
||||||
|
|
||||||
* An OS with a Bash shell
|
- An OS with a Bash shell
|
||||||
* Tools we use:
|
- Tools we use:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
awk
|
awk
|
||||||
@@ -309,21 +315,21 @@ uniq
|
|||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
* [`bsdextrautils`](https://packages.debian.org/sid/bsdextrautils) `apt install bsdextrautils`
|
- [`bsdextrautils`](https://packages.debian.org/sid/bsdextrautils) `apt install bsdextrautils`
|
||||||
* [`coreutils`](https://packages.debian.org/sid/coreutils) `apt install coreutils`
|
- [`coreutils`](https://packages.debian.org/sid/coreutils) `apt install coreutils`
|
||||||
* [`gawk`](https://packages.debian.org/sid/gawk) `apt install gawk`
|
- [`gawk`](https://packages.debian.org/sid/gawk) `apt install gawk`
|
||||||
* [`grep`](https://packages.debian.org/sid/grep) `apt install grep`
|
- [`grep`](https://packages.debian.org/sid/grep) `apt install grep`
|
||||||
* [`ncurses-bin`](https://packages.debian.org/sid/ncurses-bin) `apt install ncurses-bin`
|
- [`ncurses-bin`](https://packages.debian.org/sid/ncurses-bin) `apt install ncurses-bin`
|
||||||
|
|
||||||
## FAQ
|
## 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`
|
_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.
|
_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?
|
_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"`
|
_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))
|
(more info about [git log --submodule](https://git-scm.com/docs/git-log#Documentation/git-log.txt---submoduleltformatgt))
|
||||||
|
|
||||||
## Contribution
|
## Contribution
|
||||||
@@ -337,13 +343,13 @@ We use GitHub pull requests for this purpose.
|
|||||||
|
|
||||||
### Some tips for good pull requests
|
### Some tips for good pull requests
|
||||||
|
|
||||||
* Use our code </br>
|
- Use our code </br>
|
||||||
When in doubt, try to stay true to the existing code of the project.
|
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
|
- Write a descriptive commit message. What problem are you solving and what
|
||||||
are the consequences? Where and what did you test? Some good tips:
|
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)
|
[here](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message)
|
||||||
and [here](https://www.kernel.org/doc/Documentation/SubmittingPatches).
|
and [here](https://www.kernel.org/doc/Documentation/SubmittingPatches).
|
||||||
* If your PR consists of multiple commits which are successive improvements /
|
- If your PR consists of multiple commits which are successive improvements /
|
||||||
fixes to your first commit, consider squashing them into a single commit
|
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
|
(`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
|
HEAD. This make reviewing the code so much easier, and our history more
|
||||||
@@ -365,15 +371,15 @@ make test
|
|||||||
|
|
||||||
MIT see [LICENSE][] for the full license text.
|
MIT see [LICENSE][] for the full license text.
|
||||||
|
|
||||||
[read this page]: http://github.com/arzzen/git-quick-stats/blob/master/.github/CONTRIBUTING.md
|
[read this page]: http://github.com/git-quick-stats/git-quick-stats/blob/master/.github/CONTRIBUTING.md
|
||||||
[landing page]: http://arzzen.github.io/git-quick-stats
|
[landing page]: https://git-quick-stats.sh
|
||||||
[LICENSE]: https://github.com/arzzen/git-quick-stats/blob/master/LICENSE
|
[LICENSE]: https://github.com/git-quick-stats/git-quick-stats/blob/master/LICENSE
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
This project exists thanks to all the people who contribute.
|
This project exists thanks to all the people who contribute.
|
||||||
|
|
||||||
[](https://github.com/arzzen/git-quick-stats/graphs/contributors)
|
[](https://github.com/git-quick-stats/git-quick-stats/graphs/contributors)
|
||||||
|
|
||||||
### Backers
|
### Backers
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,14 @@ else
|
|||||||
_log_options=""
|
_log_options=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Ignore author regex
|
||||||
|
_ignore_authors=${_GIT_IGNORE_AUTHORS:-}
|
||||||
|
if [[ -n "${_ignore_authors}" ]]; then
|
||||||
|
_ignore_authors=$_ignore_authors
|
||||||
|
else
|
||||||
|
_ignore_authors=""
|
||||||
|
fi
|
||||||
|
|
||||||
# Default menu theme
|
# Default menu theme
|
||||||
# Set the legacy theme by typing "export _MENU_THEME=legacy"
|
# Set the legacy theme by typing "export _MENU_THEME=legacy"
|
||||||
_theme="${_MENU_THEME:=default}"
|
_theme="${_MENU_THEME:=default}"
|
||||||
@@ -259,7 +267,9 @@ ADDITIONAL USAGE
|
|||||||
You can set _MENU_THEME to display the legacy color scheme
|
You can set _MENU_THEME to display the legacy color scheme
|
||||||
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)\""
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -328,6 +338,14 @@ function showMenu() {
|
|||||||
read -r opt
|
read -r opt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filter_ignored_authors() {
|
||||||
|
if [[ -n "$_ignore_authors" ]]; then
|
||||||
|
grep -Ev "$_ignore_authors"
|
||||||
|
else
|
||||||
|
cat
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# FUNCTIONS FOR GENERATING STATS
|
# FUNCTIONS FOR GENERATING STATS
|
||||||
|
|
||||||
@@ -540,7 +558,7 @@ function csvOutput() {
|
|||||||
printf "files_per,commits,commits_per,lines_changed,lines_changed_per\n"
|
printf "files_per,commits,commits_per,lines_changed,lines_changed_per\n"
|
||||||
git -c log.showSignature=false log ${_branch} --use-mailmap $_merges --numstat \
|
git -c log.showSignature=false log ${_branch} --use-mailmap $_merges --numstat \
|
||||||
--pretty="format:commit %H%nAuthor: %aN <%aE>%nDate: %ad%n%n%w(0,4,4)%B%n" \
|
--pretty="format:commit %H%nAuthor: %aN <%aE>%nDate: %ad%n%n%w(0,4,4)%B%n" \
|
||||||
"$_since" "$_until" $_log_options $_pathspec | LC_ALL=C awk '
|
"$_since" "$_until" $_log_options $_pathspec | filter_ignored_authors | LC_ALL=C awk '
|
||||||
function printStats(author) {
|
function printStats(author) {
|
||||||
printf "%s,", author
|
printf "%s,", author
|
||||||
if(more["total"] > 0) {
|
if(more["total"] > 0) {
|
||||||
@@ -734,7 +752,7 @@ function branchesByDate() {
|
|||||||
function contributors() {
|
function contributors() {
|
||||||
optionPicked "All contributors (sorted by name):"
|
optionPicked "All contributors (sorted by name):"
|
||||||
git -c log.showSignature=false log --use-mailmap $_merges "$_since" "$_until" \
|
git -c log.showSignature=false log --use-mailmap $_merges "$_since" "$_until" \
|
||||||
--format='%aN' $_log_options $_pathspec | sort -u | cat -n
|
--format='%aN' $_log_options $_pathspec | filter_ignored_authors | sort -u | cat -n
|
||||||
}
|
}
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
@@ -750,7 +768,7 @@ function newContributors() {
|
|||||||
for c in $contributors; do
|
for c in $contributors; do
|
||||||
local firstCommit=$(git -c log.showSignature=false log --author="$c" \
|
local firstCommit=$(git -c log.showSignature=false log --author="$c" \
|
||||||
--reverse --use-mailmap $_merges "$_since" "$_until" \
|
--reverse --use-mailmap $_merges "$_since" "$_until" \
|
||||||
--format='%at' $_log_options $_pathspec | head -n 1)
|
--format='%at' $_log_options $_pathspec | filter_ignored_authors | head -n 1)
|
||||||
if [[ $firstCommit -ge $(date -d "$newDate" +%s) ]]; then
|
if [[ $firstCommit -ge $(date -d "$newDate" +%s) ]]; then
|
||||||
echo "$c"
|
echo "$c"
|
||||||
fi
|
fi
|
||||||
@@ -767,10 +785,10 @@ function commitsPerAuthor() {
|
|||||||
optionPicked "Git commits per author:"
|
optionPicked "Git commits per author:"
|
||||||
local authorCommits=$(git -c log.showSignature=false log --use-mailmap \
|
local authorCommits=$(git -c log.showSignature=false log --use-mailmap \
|
||||||
$_merges "$_since" "$_until" $_log_options \
|
$_merges "$_since" "$_until" $_log_options \
|
||||||
| grep -i Author: | cut -c9-)
|
| grep -i '^Author:' | cut -c9-)
|
||||||
local coAuthorCommits=$(git -c log.showSignature=false log --use-mailmap \
|
local coAuthorCommits=$(git -c log.showSignature=false log --use-mailmap \
|
||||||
$_merges "$_since" "$_until" $_log_options \
|
$_merges "$_since" "$_until" $_log_options \
|
||||||
| grep -i Co-Authored-by: | cut -c21-)
|
| grep -i '^ Co-Authored-by:' | cut -c21-)
|
||||||
|
|
||||||
if [[ -z "${coAuthorCommits}" ]]; then
|
if [[ -z "${coAuthorCommits}" ]]; then
|
||||||
allCommits="${authorCommits}"
|
allCommits="${authorCommits}"
|
||||||
@@ -1060,7 +1078,7 @@ function suggestReviewers() {
|
|||||||
optionPicked "Suggested code reviewers (based on git history):"
|
optionPicked "Suggested code reviewers (based on git history):"
|
||||||
git -c log.showSignature=false log --use-mailmap $_merges "$_since" "$_until" \
|
git -c log.showSignature=false log --use-mailmap $_merges "$_since" "$_until" \
|
||||||
--pretty=%aN $_log_options $_pathspec | head -n 100 | sort | uniq -c \
|
--pretty=%aN $_log_options $_pathspec | head -n 100 | sort | uniq -c \
|
||||||
| sort -nr | LC_ALL=C awk '
|
| filter_ignored_authors | sort -nr | LC_ALL=C awk '
|
||||||
{ args[NR] = $0; }
|
{ args[NR] = $0; }
|
||||||
END {
|
END {
|
||||||
for (i = 1; i <= NR; ++i) {
|
for (i = 1; i <= NR; ++i) {
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ You can set _GIT_BRANCH to set the branch of the stats, example:
|
|||||||
.PP
|
.PP
|
||||||
.B export _GIT_BRANCH="master"
|
.B export _GIT_BRANCH="master"
|
||||||
.PP
|
.PP
|
||||||
.SH CALENDAR ACTIVITY OUTPUT
|
.SH Calendar activity output
|
||||||
.PP
|
.PP
|
||||||
\fBactivity-calendar\fR outputs a visual grid of commit activity for a selected author, grouped by day-of-week (rows: Mon..Sun) and month (columns: Jan..Dec). Each cell is 3 characters wide, separated by one space.
|
\fBactivity-calendar\fR outputs a visual grid of commit activity for a selected author, grouped by day-of-week (rows: Mon..Sun) and month (columns: Jan..Dec). Each cell is 3 characters wide, separated by one space.
|
||||||
.PP
|
.PP
|
||||||
@@ -190,6 +190,11 @@ Sat ░░░ ░░░ ▒▒▒ ░░░ ░░░ ░░░ ▒▒▒ ░
|
|||||||
Sun ▓▓▓ ░░░ ▓▓▓ ░░░ ░░░ ▓▓▓ ░░░ ▒▒▒ ░░░ ░░░ ▓▓▓ ░░░
|
Sun ▓▓▓ ░░░ ▓▓▓ ░░░ ░░░ ▓▓▓ ░░░ ▒▒▒ ░░░ ░░░ ▓▓▓ ░░░
|
||||||
|
|
||||||
Legend: ... = 0 ░░░ = 1–2 ▒▒▒ = 3–5 ▓▓▓ = 6+ commits
|
Legend: ... = 0 ░░░ = 1–2 ▒▒▒ = 3–5 ▓▓▓ = 6+ commits
|
||||||
|
.PP
|
||||||
|
You can set _GIT_IGNORE_AUTHORS to filter out specific authors, example:
|
||||||
|
.PP
|
||||||
|
.B export _GIT_IGNORE_AUTHORS="(author@examle.com|username)"
|
||||||
|
.
|
||||||
.fi
|
.fi
|
||||||
|
|
||||||
.PP
|
.PP
|
||||||
|
|||||||
Reference in New Issue
Block a user