Compare commits

...

82 Commits

Author SHA1 Message Date
arzzen
125eec7136 Merge pull request #195 from tomice/issues/194-flatten-awk-arrays-for-bsd-awk-compat
Flatten arrays for wider awk compatibility
2025-09-02 11:46:39 +02:00
Tom Ice
d61c812247 Flatten arrays for wider awk compatibility
* The current implementation of the calendar heatmap by author
  contains multidimensional arrays. This works with newer versions
  of awk, but can cause issues with systems that use an older variant
  which cannot easily handle these calculations. macOS is especially
  impacted by this.

  By flattening the arrays from a multidimensional array to a single
  dimensional array, we can maintain greater compatibility across awk
  variants without requiring the user to install additional versions
  of awk.

Addresses issue #194
2025-08-31 16:22:59 -04:00
arzzen
261262ab4e Update Dockerfile - add coreutils 2025-08-03 18:48:37 +02:00
arzzen
e968ef62b9 Merge pull request #190 from git-quick-stats/task/commits-heatmap
commits heatmap
2025-06-29 08:57:05 +02:00
arzzen
74261c1e50 smallfixes 2025-06-29 08:55:49 +02:00
arzzen
4eade09673 Merge branch 'task/commits-heatmap' of github.com:git-quick-stats/git-quick-stats into task/commits-heatmap 2025-06-28 22:25:09 +02:00
arzzen
47a9151886 fix: tput colors, local vars 2025-06-28 22:24:51 +02:00
arzzen
916d5e1e0f Merge branch 'master' of github.com:git-quick-stats/git-quick-stats into task/commits-heatmap 2025-06-25 17:50:40 +02:00
arzzen
17a9d1427b Update git-quick-stats 2025-06-22 20:06:31 +02:00
arzzen
091562d4f8 Merge pull request #191 from git-quick-stats/task/citation-file
citation file
2025-06-22 20:03:57 +02:00
arzzen
748576b541 citation file 2025-06-22 20:03:38 +02:00
arzzen
f43ab22172 remove sponsors 2025-06-22 19:51:06 +02:00
arzzen
4d2e52aa6d commits heatmap 2025-06-22 19:49:49 +02:00
arzzen
08c0ca1d85 Update README.md 2025-06-17 19:24:24 +02:00
arzzen
e8843da10e Merge pull request #189 from git-quick-stats/134-feature-request-sorting-contribution-stats
Sorting contribution stats
2025-06-17 19:03:55 +02:00
arzzen
376887a394 update manpage 2025-06-17 19:01:38 +02:00
arzzen
cebb5a8f48 Merge pull request #188 from git-quick-stats/task/issue-116
_MENU_THEME=none
2025-06-17 18:52:01 +02:00
arzzen
343351b762 update manpage 2025-06-17 18:49:38 +02:00
arzzen
95136d3f92 add filter ignored authors 2025-06-16 14:40:49 +02:00
arzzen
79c735c814 fix backslash 2025-06-16 14:36:11 +02:00
arzzen
ec6a95d2ef cleanup 2025-06-16 14:33:03 +02:00
arzzen
b65b100cd8 fix tests 2025-06-16 14:29:24 +02:00
arzzen
dd7719c3b0 sorting contribution stats 2025-06-16 14:03:21 +02:00
arzzen
c34ceb4c0e _MENU_THEME=none 2025-06-16 08:55:00 +02:00
arzzen
850b7453eb Merge pull request #187 from FloezeTv/fix/default-until-date-locale 2025-06-15 15:32:51 +02:00
FloezeTv
5063d1aad7 Fix default until-date in other locales
The default until-date used `date` with the system's default locale
as `date` produces localized output by default.
However, `date -d` cannot parse this localized output
but requires a locale independent format:
https://www.gnu.org/software/coreutils/manual/html_node/Options-for-date.html#index-_002dd-19
This sets the locale to a format parsable by `date` as in the article.
2025-06-15 14:03:10 +02:00
arzzen
53b9971cf7 fix tests 2025-06-15 13:30:16 +02:00
arzzen
eec6d53ce9 Merge pull request #183 from git-quick-stats/feat/activity-calendar
Activity calendar by author
2025-06-14 19:04:01 +02:00
arzzen
d06a7ca090 Merge branch 'master' into feat/activity-calendar 2025-06-14 19:03:52 +02:00
arzzen
462439a855 Merge pull request #184 from git-quick-stats/task/ignore-authors
Ignore authors #141
2025-06-14 19:02:48 +02:00
arzzen
c467a9694b merge 2025-06-14 14:48:39 +02:00
arzzen
d4f71cfdad removed unuse arrays 2025-06-14 14:43:14 +02:00
arzzen
88e369503e link correction 2025-06-14 14:38:28 +02:00
arzzen
afd61ce9c2 Ignore authors #141 2025-06-14 14:30:56 +02:00
arzzen
e1e02024a1 Activity calendar by author 2025-06-08 19:39:29 +02:00
arzzen
d1641f7bf3 Merge pull request #181 from jwilk-forks/anchor-regexps
Anchor regexps in commitsPerAuthor()
2025-06-08 19:33:43 +02:00
arzzen
8de8c43212 Merge pull request #182 from jwilk-forks/json-spelling 2025-02-27 17:49:37 +01:00
Jakub Wilk
f4ec72073d Fix typo in JSON output 2025-02-24 08:40:54 +01:00
Jakub Wilk
b0003bef49 Anchor regexps in commitsPerAuthor()
Fixes:

    $ git clone -q https://github.com/util-linux/util-linux.git
    $ git -C util-linux quick-stats -a | grep -w uthor
            23    uthor                                    Karel Zak              0.1%
            3     uthor                                    Ondrej Oprala          0.0%
            2     uthor                                    Samuel Thibault        0.0%
            ...
2025-02-24 08:32:23 +01:00
arzzen
a833a5f431 Update .mailmap 2025-01-14 13:49:39 +01:00
arzzen
886f64f086 Merge pull request #180 from reitzig/patch-1
fix(docker): tell Git that the workdir is safe
2025-01-05 17:43:46 +01:00
Raphael
115b21a48d fix(docker): tell Git that the workdir is safe
When bind-mounting a Git repository to the workdir, Git would complain about 'dubious ownership'.

We add an exception to the global Git config, in the way Git tells us to.
This should be safe since
- we run in a container, and
- the user can set the mount to read-only.

refs: issue #179
2025-01-03 14:00:30 +01:00
arzzen
4d515b88b3 Update LICENSE 2024-10-27 14:07:49 +01:00
arzzen
9b3c0e5db1 Merge pull request #176 from tomice/bugfix/161-changelogs-wrong-output
Address inconsistency in changelogs
2024-10-25 20:26:54 +02:00
arzzen
86ad0af8bb Update FUNDING.yml 2024-10-25 20:18:35 +02:00
Tom Ice
fb488abe3e Address inconsistency in changelogs
* Original function lacked explicit sorting by time.
  Adding sorting by time within the same day to help make
  changelogs consistent.
2024-10-12 17:16:21 -04:00
arzzen
3cce04ddad Merge pull request #174 from tomice/master 2024-10-06 16:04:25 +02:00
Tom Ice
d4e56cf557 Adjust commitsByYear() to support multiple dates
* commitsByYear() previously could only support Default-style
  dates for git log. However, a user can use a variety of different
  date formats such as relative, default, iso, rfc, short, and raw.

  This change modifies commitsByYear() to handle multiple different
  date strings

Fixes #172
2024-10-01 20:43:39 -04:00
Tom Ice
cf239e5523 Update README.md
* Update README.md's screenshots to show new features added since last screenshots were taken
2024-09-19 20:45:36 -04:00
Tom Ice
a0f495894b Merge pull request #173 from laxdog/master
Fix stats for situation where there are no inserts / deletes
2024-09-19 16:20:32 -04:00
Tom Ice
4faf233ad1 Merge pull request #170 from funnelfiasco/issue169-add_new_contributors
Add a list of new contributors
2024-09-19 16:20:00 -04:00
Ben Cotton
7d5087795e Address more feedback
* Add date examples to prompts
* Update tests

Signed-off-by: Ben Cotton <bcotton@funnelfiasco.com>
2024-09-19 14:28:41 -04:00
Ben Cotton
fe2df31c36 Address review feedback
* Indicate how we're sorting new contributors
* Don't fork for `date` checks
* Include reference in the manpage

Signed-off-by: Ben Cotton <bcotton@funnelfiasco.com>
2024-09-19 11:57:38 -04:00
Michael Robinson
615563459f Fix stats for situation where there are no inserts / deletes 2024-09-17 15:39:48 +01:00
Ben Cotton
8c1d81a29d Add a list of new contributors
This reports generates a list of all contributors whose first commit was
after a specified date.

Fixes #169

Signed-off-by: Ben Cotton <bcotton@funnelfiasco.com>
2024-06-26 09:59:46 -04:00
Tom Ice
9f96cecf42 Merge pull request #167 from tomice/master
Update documentation for clarity
2024-05-17 22:05:55 -04:00
Tom Ice
5b01b5e055 Update documentation for clarity
* Added additional information to better explain how to use this
  on macOS.

* Updated some of the deps used

* Minor adjustments in the README.md

Addresses Issue #166
2024-05-16 15:23:16 -04:00
arzzen
32a84903ff Merge pull request #165 from chenrui333/patch-1
improve macos error message wrt gnu date
2024-04-29 15:46:11 +02:00
Rui Chen
cd6d67df06 improve macos error message wrt gnu date 2024-04-28 11:17:22 -04:00
Tom Ice
00d13c0b79 Merge pull request #164 from tomice/master
Handle error where BSD date is being used
Create new repo if running tests in non-git area
2024-04-27 13:43:51 -04:00
Tom Ice
b525ed3b5c Create new repo if running tests in non-git area
* When running "make test" in the root directory of this codebase,
  an error will occur as this shell script requires a repo to be
  initialized before it can properly execute.

  This was done in the past, but at some point, it was removed.
  This adds the feature back, tests if we are in a git directory
  by using a built-in git command, and only performs this action
  if a git repo doesn't already exist. All actions are sent to
  /dev/null so the testing should look opaque to the end user.

  Note that tests will still fail if a user is missing a required
  utility to perform the functionality of git-quick-stats.

* Fixed a typo in the man page

Fixes #162
2024-04-20 17:31:12 -04:00
Tom Ice
41a8542aaa Handle error where BSD date is being used
* Users on macOS and other older distributions of Linux and Unix
  cannot fully utilize this application as a handful of date/time
  strings in here are specific to the GNU utility found on most
  modern version of Linux.

  Until every date/time case is handled between the BSD version of
  date and the GNU version of date, let's error out akin to how we
  do it if the user doesn't have every utility installed to run
  this script.

  Users can get around this by using package managers on macOS such
  as homebrew, macports, etc and making sure that 'date' points to
  the GNU version of date instead of the BSD version. Linux and
  Unix users can get around this by installing the GNU version of
  date, as well.

* Removed checking OSTYPE in the format_date() function as checking
  if someone is on a machine that identifies as Darwin is not enough
  to handle other edge cases where an older version of BSD date
  might be present on the system.
2024-04-20 14:15:07 -04:00
arzzen
7b1e0b2a65 Merge pull request #157 from Dica-Developer/41
calculate the day before the given since date
2024-01-10 08:13:40 +01:00
Martin Schaaf
43bc82520e calculate the day before the given since date as it excludes the given daten the inclusion is wanted 2024-01-09 16:40:28 +01:00
arzzen
d33ede9bcc Merge pull request #142 from cam-rod/timezone-format
Update formatting and sort commits by timezone
2023-12-22 16:18:52 +01:00
arzzen
7f24d202b9 Merge pull request #155 from fox-forks/hyperupcall-document-defualt-git-limit
docs: Document default `_GIT_LIMIT` value
2023-12-22 16:17:22 +01:00
Edwin Kofler
62b128a3ce docs: Document default _GIT_LIMIT value 2023-11-18 17:44:29 -08:00
arzzen
8515fe3a94 cleanup 2023-10-24 18:13:00 +02:00
arzzen
37bfde67ed Merge pull request #153 from arzzen/arzzen-patch-1 2023-10-24 15:33:53 +02:00
arzzen
d886facadf fix format date 2023-10-24 14:52:00 +02:00
arzzen
aa6619508a Update git-quick-stats
fix #152
2023-10-24 09:34:29 +02:00
arzzen
a813846c9f Merge pull request #151 from YDX-2147483647/patch-1
fix: Ubuntu does not support `date -j`
2023-10-17 06:26:33 +02:00
Y.D.X
22bf354da4 fix: Ubuntu does not support date -j
This is required for changelogs.

Resolves #147
2023-10-09 17:29:08 +08:00
arzzen
0fea0323a4 Merge pull request #150 from riderius/master 2023-10-04 20:50:24 +02:00
riderius
4fcf8f5fef test: fix a typo in the 1st test
Signed-off-by: riderius <riderius.help@gmail.com>
2023-10-04 18:27:38 +03:00
arzzen
374aa2ef72 Merge pull request #145 from s-okita/master
Add stats by author per weekday functionality
2023-06-23 15:01:04 +02:00
s-okita
33dca7f3ed Update git-quick-stats.1 2023-06-23 17:07:18 +09:00
s-okita
2ecb296442 Merge branch 'arzzen:master' into master 2023-06-07 02:42:22 +09:00
arzzen
428d25d0ef Merge pull request #144 from jgtoriginal/master
add day name to date
2023-06-06 14:58:29 +02:00
s-okita
c3110e985e Add stats by author per weekday functionality
* Added the ability to see git stats both per weekday, as well as
  by author per weekday. It should respect all global options.

* Updated tests, README.md, and man page to reflect the new changes
2023-06-06 19:36:47 +09:00
jgtoriginal
ebbeb34837 add day name to date
when grouping by author -L, I found it hard to read YYYY-MM-DD, so added day name to that.
2023-05-25 01:14:05 +01:00
Cameron Rodriguez
6cdca7c7c7 Sort, use more stable formatting for commits by timezone
Switch to `git log` for formatting commits sorted by timezone, to avoid
odd formatting cases. Also sorts timezones from negative to positive.
2023-04-04 22:30:35 -04:00
11 changed files with 1370 additions and 798 deletions

5
.github/FUNDING.yml vendored
View File

@@ -1,6 +1 @@
# 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 Mestan <lukas.mestan@gmail.com> Lukáš Mešťan <arzzen@users.noreply.github.com> Lukas <test@gmail.com> Lukáš <arzzen@users.noreply.github.com>
Lukas Mestan <lukas.mestan@gmail.com> arzzen Lukas <lukas@gmail.com> arzzen

25
CITATION.cff Normal file
View File

@@ -0,0 +1,25 @@
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 util-linux \ RUN apk add --no-cache bash git make ncurses coreutils util-linux \
&& cd /app \ && cd /app \
&& make install \ && make install \
&& rm -rf /app \ && rm -rf /app \
@@ -23,5 +23,6 @@ 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) 2021 Lukáš Mešťan Copyright (c) 2024 git-quick-stats.sh
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/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)

184
README.md
View File

@@ -1,12 +1,12 @@
# 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 [![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) [![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) [![Travis](https://api.travis-ci.org/arzzen/git-quick-stats.svg?branch=master)](https://travis-ci.org/arzzen/git-quick-stats) [![Homebrew package](https://repology.org/badge/version-for-repo/homebrew/git-quick-stats.svg)](https://formulae.brew.sh/formula/git-quick-stats#default) [![Linuxbrew package](https://repology.org/badge/version-for-repo/linuxbrew/git-quick-stats.svg)](https://repology.org/metapackage/git-quick-stats/packages) [![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 dont 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 :).
![mainMenuScreenshot](https://user-images.githubusercontent.com/8818630/154823670-f42a111b-45f4-47fc-aea7-80059827c8e6.png)
![mainImageScreenshot](https://github.com/user-attachments/assets/7d8637a4-5a67-49f6-8724-ca7548b987c6)
## Table of Contents ## Table of Contents
@@ -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,14 +49,16 @@
[**Contributors**](#contributors) [**Contributors**](#contributors)
* [**Backers**](#backers) - [**Backers**](#backers)
* [**Sponsors**](#sponsors) - [**Sponsors**](#sponsors)
## Screenshots ## Screenshots
![commitsByWeekdayScreenshot](https://user-images.githubusercontent.com/8818630/154823677-e34ca867-ae61-4755-bf89-c877f809c591.png) ![commitsByWeekdayScreenshot](https://github.com/user-attachments/assets/3496d245-6385-47d1-878a-726e79100eb1)
![commitsByHourScreenshot](https://user-images.githubusercontent.com/8818630/154823679-bdadc26c-c644-4a01-b625-85e330f85d41.png) ![commitsByHourScreenshot](https://github.com/user-attachments/assets/9f1d69d9-46e0-411d-a5ed-905ffdfb887a)
![commitActivityScreenshot](https://github.com/user-attachments/assets/693fff31-65c7-4b9f-a011-6114a2d10a26)
## Usage ## Usage
@@ -116,16 +118,20 @@ LIST OPTIONS
show branches by date show branches by date
-C, --contributors -C, --contributors
see a list of everyone who contributed to the repo see a list of everyone who contributed to the repo
-n, --new-contributors
list everyone who made their first contribution since a specified date
-a, --commits-per-author -a, --commits-per-author
displays a list of commits per author displays a list of commits per author
-d, --commits-per-day -d, --commits-per-day
displays a list of commits per day displays a list of commits per day
-Y, --commits-by-year
displays a list of commits per year
-m, --commits-by-month -m, --commits-by-month
displays a list of commits per month displays a list of commits per month
-Y, --commits-by-year
displays a list of commits per year
-w, --commits-by-weekday -w, --commits-by-weekday
displays a list of commits per weekday displays a list of commits per weekday
-W, --commits-by-author-by-weekday
displays a list of commits per weekday by author
-o, --commits-by-hour -o, --commits-by-hour
displays a list of commits per hour displays a list of commits per hour
-A, --commits-by-author-by-hour -A, --commits-by-author-by-hour
@@ -135,6 +141,12 @@ 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
@@ -155,7 +167,7 @@ Once set, run `git quick-stats` as normal. Note that this affects all stats that
### Git log limit ### Git log limit
You can set variable `_GIT_LIMIT` for limited output. It will affect the "changelogs" and "branch tree" 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 ```bash
export _GIT_LIMIT=20 export _GIT_LIMIT=20
@@ -200,15 +212,42 @@ You can set the variable `_GIT_BRANCH` to set the branch of the stats. Works wit
export _GIT_BRANCH="master" 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 ### 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`.
You can completely disable the color theme by setting the `_MENU_THEME` variable to `none`.
```bash ```bash
export _MENU_THEME="legacy" export _MENU_THEME="legacy"
# or
export _MENU_THEME="none"
``` ```
![legacyThemeScreenshot](https://user-images.githubusercontent.com/8818630/154823711-3dd0c268-f3cb-42e5-9094-0eb8e45d1761.png) ![legacyThemeScreenshot](https://github.com/user-attachments/assets/3b319c1a-827f-47b8-bbfa-b8b59a39deef)
## Installation ## Installation
@@ -223,7 +262,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
``` ```
@@ -241,18 +280,34 @@ sudo make reinstall
### macOS (homebrew) ### macOS (homebrew)
macOS requires GNU coreutils to be installed and for the non "g" aliased
versions to be exported to your path. The following is an example of how to
perform this if you are using Homebrew as your package manager.
```bash
brew install coreutils
export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
```
From there, you can install via Homebrew as follows:
```bash ```bash
brew install git-quick-stats brew install git-quick-stats
``` ```
Or you can follow the UNIX and Linux instructions if you wish. Or you can follow the UNIX and Linux instructions if you wish.
If you would like to default to using the GNU coreutils (recommended), then you
can add `export PATH="$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"` to
your applicable `~/.bash_profile`, `~/.zprofile`, or other relevant profile
based on the shell of your choice.
### Windows ### Windows
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.
@@ -260,20 +315,21 @@ 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
basename basename
cat cat
column column
date
echo echo
git git
grep grep
@@ -288,17 +344,21 @@ uniq
### Dependencies ### Dependencies
* [`bsdmainutils`](https://packages.debian.org/sid/bsdmainutils) `apt install bsdmainutils` - [`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 ## 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
@@ -312,13 +372,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
@@ -340,36 +400,12 @@ 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.
[![contributors](https://opencollective.com/git-quick-stats/contributors.svg?width=890&button=false)](https://github.com/arzzen/git-quick-stats/graphs/contributors) [![contributors](https://opencollective.com/git-quick-stats/contributors.svg?width=890&button=false)](https://github.com/git-quick-stats/git-quick-stats/graphs/contributors)
### Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/git-quick-stats#backer)]
[![backers](https://opencollective.com/git-quick-stats/backers.svg?width=890)](https://opencollective.com/git-quick-stats#backers)
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/git-quick-stats#sponsor)]
[![sponsor0](https://opencollective.com/git-quick-stats/sponsor/0/avatar.svg?v=1)](https://opencollective.com/git-quick-stats/sponsor/0/website)
[![sponsor1](https://opencollective.com/git-quick-stats/sponsor/1/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/1/website)
[![sponsor2](https://opencollective.com/git-quick-stats/sponsor/2/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/2/website)
[![sponsor3](https://opencollective.com/git-quick-stats/sponsor/3/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/3/website)
[![sponsor4](https://opencollective.com/git-quick-stats/sponsor/4/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/4/website)
[![sponsor5](https://opencollective.com/git-quick-stats/sponsor/5/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/5/website)
[![sponsor6](https://opencollective.com/git-quick-stats/sponsor/6/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/6/website)
[![sponsor7](https://opencollective.com/git-quick-stats/sponsor/7/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/7/website)
[![sponsor8](https://opencollective.com/git-quick-stats/sponsor/8/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/8/website)
[![sponsor9](https://opencollective.com/git-quick-stats/sponsor/9/avatar.svg)](https://opencollective.com/git-quick-stats/sponsor/9/website)
[![61999966](https://user-images.githubusercontent.com/6382002/130024560-65bb49a6-c7e9-48f9-8427-a29d8ff2a3db.png)](https://quaestor.com/?utm_source=github&utm_category=sponsor)

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
.TH git-quick-stats "1" "June 2021" "git-quick-stats" "User Commands" .TH git-quick-stats "1" "June 2025" "git-quick-stats" "User Commands"
.SH NAME .SH NAME
.B git\-quick\-stats .B git\-quick\-stats
\- Simple and efficient way to access various stats in a git repository. \- Simple and efficient way to access various stats in a git repository.
@@ -19,6 +19,10 @@ This program allows you to see detailed information about a git repository.
.PP .PP
.SH GENERATE OPTIONS .SH GENERATE OPTIONS
.PP .PP
\fB\-h\fR, \-?, \fB\-\-help\fR
.IP
display this help text in the terminal
.PP
\fB\-T\fR, \fB\-\-detailed\-git\-stats\fR \fB\-T\fR, \fB\-\-detailed\-git\-stats\fR
.IP .IP
give a detailed list of git stats give a detailed list of git stats
@@ -70,6 +74,11 @@ show branches by date
see a list of everyone who contributed to the repo see a list of everyone who contributed to the repo
.HP .HP
.PP .PP
\fB\-n\fR, \fB\-\-new\-contributors\fR
.IP
list everyone who made their first contribution since a specified date
.HP
.PP
\fB\-a\fR, \fB\-\-commits\-per\-author\fR \fB\-a\fR, \fB\-\-commits\-per\-author\fR
.IP .IP
displays a list of commits per author displays a list of commits per author
@@ -95,6 +104,11 @@ displays a list of commits per year
displays a list of commits per weekday displays a list of commits per weekday
.HP .HP
.PP .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 \fB\-o\fR, \fB\-\-commits\-by\-hour\fR
.IP .IP
displays a list of commits per hour displays a list of commits per hour
@@ -114,6 +128,11 @@ displays a list of commits per timezone
.IP .IP
displays a list of commits per timezone by author displays a list of commits per timezone by author
.HP .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 .SH SUGGEST OPTIONS
.PP .PP
\fB\-r\fR, \fB\-\-suggest\-reviewers\fR \fB\-r\fR, \fB\-\-suggest\-reviewers\fR
@@ -121,9 +140,12 @@ displays a list of commits per timezone by author
show the best people to contact to review code show the best people to contact to review code
.HP .HP
.PP .PP
\fB\-h\fR, \-?, \fB\-\-help\fR .SH CALENDAR OPTIONS
.IP .PP
display this help text in the terminal \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 .PP
.SH ADDITIONAL USAGE .SH ADDITIONAL USAGE
You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log, example: You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log, example:
@@ -150,12 +172,35 @@ You can also set _GIT_MERGE_VIEW to only show merge commits, example:
.PP .PP
.B export _GIT_MERGE_VIEW="exclusive" .B export _GIT_MERGE_VIEW="exclusive"
.PP .PP
You can switch to the legacy color scheme, example: You can sort contribution stats by field "name", "commits", "insertions", "deletions", or "lines" (total lines changed) and order ("asc", "desc"). e.g.: "commits-desc"
.PP
.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 .PP
.B export _MENU_THEME=legacy .B export _MENU_THEME=legacy
.PP .PP
or
.B export _MENU_THEME=none
.PP
You can set _GIT_BRANCH to set the branch of the stats, example: 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
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 .fi
.PP
.SH SEE ALSO
.BR git (1)
.PP
Project homepage:
.UR https://github.com/git-quick-stats/git-quick-stats
.UE

View File

@@ -1,9 +1,17 @@
#!/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 assert "$src fail" "Invalid argument: fail
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
@@ -42,6 +50,8 @@ LIST OPTIONS
show branches by date show branches by date
-C, --contributors -C, --contributors
see a list of everyone who contributed to the repo see a list of everyone who contributed to the repo
-n, --new-contributors
list everyone who made their first contribution since a specified date
-a, --commits-per-author -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
@@ -52,6 +62,8 @@ LIST OPTIONS
displays a list of commits per year displays a list of commits per year
-w, --commits-by-weekday -w, --commits-by-weekday
displays a list of commits per weekday displays a list of commits per weekday
-W, --commits-by-author-by-weekday
displays a list of commits per weekday by author
-o, --commits-by-hour -o, --commits-by-hour
displays a list of commits per hour displays a list of commits per hour
-A, --commits-by-author-by-hour -A, --commits-by-author-by-hour
@@ -61,6 +73,12 @@ 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
@@ -80,17 +98,24 @@ 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 set _MENU_THEME to display the legacy color scheme 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 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" assert_contains "$src --detailed-git-stats" "Contribution stats (by author) on the current branch"
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"

View File

@@ -1,17 +1,16 @@
#!/bin/sh #!/bin/sh
# Initialises a new local Git repo for test purpose. # Initialises a new local Git repo for test purpose if one does not exist already
if test -d ../test-git/.git; then rm -Rf ../test-git/.git; fi if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
#mkdir test-git {
cd ../test-git git init
git init git config user.name "$(printf %s 'Test Git,\nfor test purpose')"
git config user.name "$(printf %s 'Test Git,\nfor test purpose')" git config user.email "TestGit\o/@example.org"
git config user.email "TestGit\o/@example.org"
#printf '\n[user]\nname = test-git\nemail = test-git@example.org\n'> .git/config printf 'test-git\n========\n' > README.md
printf 'test-git\n========\n' > README.md git add 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'
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')"
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"
#printf '# testChars [%s]\n' "$testChars">&2 git log
git notes add -m 'Some notes' -m 'out of ascii: été au cœur' -m "$testChars" } >/dev/null 2>&1
git log fi