mirror of
https://github.com/git-quick-stats/git-quick-stats.git
synced 2025-12-21 12:13:52 +01:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b1e0b2a65 | ||
|
|
43bc82520e | ||
|
|
d33ede9bcc | ||
|
|
7f24d202b9 | ||
|
|
62b128a3ce | ||
|
|
8515fe3a94 | ||
|
|
37bfde67ed | ||
|
|
d886facadf | ||
|
|
aa6619508a | ||
|
|
a813846c9f | ||
|
|
22bf354da4 | ||
|
|
0fea0323a4 | ||
|
|
4fcf8f5fef | ||
|
|
374aa2ef72 | ||
|
|
33dca7f3ed | ||
|
|
2ecb296442 | ||
|
|
428d25d0ef | ||
|
|
c3110e985e | ||
|
|
ebbeb34837 | ||
|
|
6cdca7c7c7 |
10
README.md
10
README.md
@@ -1,5 +1,6 @@
|
||||
|
||||
# GIT quick statistics [](#backers) [](#sponsors) [](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) [](https://travis-ci.org/arzzen/git-quick-stats) [](https://formulae.brew.sh/formula/git-quick-stats#default) [](https://repology.org/metapackage/git-quick-stats/packages)
|
||||
# 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)
|
||||
|
||||
> `git-quick-stats` is a simple and efficient way to access various statistics in a git repository.
|
||||
>
|
||||
@@ -126,6 +127,8 @@ LIST OPTIONS
|
||||
displays a list of commits per month
|
||||
-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
|
||||
@@ -155,7 +158,7 @@ Once set, run `git quick-stats` as normal. Note that this affects all stats that
|
||||
|
||||
### 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
|
||||
export _GIT_LIMIT=20
|
||||
@@ -370,6 +373,3 @@ Support this project by becoming a sponsor. Your logo will show up here with a l
|
||||
[](https://opencollective.com/git-quick-stats/sponsor/7/website)
|
||||
[](https://opencollective.com/git-quick-stats/sponsor/8/website)
|
||||
[](https://opencollective.com/git-quick-stats/sponsor/9/website)
|
||||
|
||||
[](https://quaestor.com/?utm_source=github&utm_category=sponsor)
|
||||
|
||||
|
||||
@@ -102,6 +102,23 @@ function optionPicked() {
|
||||
echo -e "${msg}\n"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# DESC: Format date string
|
||||
# ARGS: $* (required): String
|
||||
# OUTS: String
|
||||
################################################################################
|
||||
format_date() {
|
||||
local date="${1}"
|
||||
local outf="${2}"
|
||||
local datef="${3:-"%b %d %H:%M:%S %Y %Z"}" # Tue Oct 24 13:34:22 2023 +0300
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
local resp="$(date -d "${date}" "+${outf}")"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
local resp="$(date -j -f "${datef}" "${date}" "+${outf}")"
|
||||
fi
|
||||
printf "%s" "${resp}"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# DESC: Help information printed to stdout during non-interactive mode
|
||||
# ARGS: None
|
||||
@@ -158,6 +175,8 @@ LIST OPTIONS
|
||||
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
|
||||
@@ -243,12 +262,13 @@ function showMenu() {
|
||||
printf %b "${NUMS} 13)${TEXT} Git commits per month\\n"
|
||||
printf %b "${NUMS} 14)${TEXT} Git commits per year\\n"
|
||||
printf %b "${NUMS} 15)${TEXT} Git commits per weekday\\n"
|
||||
printf %b "${NUMS} 16)${TEXT} Git commits per hour\\n"
|
||||
printf %b "${NUMS} 17)${TEXT} Git commits per hour by author\\n"
|
||||
printf %b "${NUMS} 18)${TEXT} Git commits per timezone\\n"
|
||||
printf %b "${NUMS} 19)${TEXT} Git commits per timezone by author\\n"
|
||||
printf %b "${NUMS} 16)${TEXT} Git commits per weekday by author\\n"
|
||||
printf %b "${NUMS} 17)${TEXT} Git commits per hour\\n"
|
||||
printf %b "${NUMS} 18)${TEXT} Git commits per hour by author\\n"
|
||||
printf %b "${NUMS} 19)${TEXT} Git commits per timezone\\n"
|
||||
printf %b "${NUMS} 20)${TEXT} Git commits per timezone by author\\n"
|
||||
printf %b "\\n${TITLES} Suggest:\\n"
|
||||
printf %b "${NUMS} 20)${TEXT} Code reviewers (based on git history)\\n"
|
||||
printf %b "${NUMS} 21)${TEXT} Code reviewers (based on git history)\\n"
|
||||
printf %b "\\n${HELP_TXT}Please enter a menu option or ${EXIT_TXT}press Enter to exit.\\n"
|
||||
printf %b "${TEXT}> ${NORMAL}"
|
||||
read -r opt
|
||||
@@ -391,11 +411,12 @@ function changelogs() {
|
||||
--date=short "${_author}" "$_since" "$_until" $_log_options $_pathspec \
|
||||
| sort -u -r | head -n $_limit \
|
||||
| while read DATE; do
|
||||
echo -e "\n[$DATE]"
|
||||
day=$(format_date "$DATE" "%A" "%Y-%m-%d")
|
||||
echo -e "\n[$DATE - $day]"
|
||||
GIT_PAGER=cat git -c log.showSignature=false log \
|
||||
--use-mailmap $_merges \
|
||||
--format=" * %s (%aN)" "${_author}" \
|
||||
--since=$DATE --until=$next
|
||||
--since==$(date -d "$DATE - 1 day" +"%Y-%m-%d") --until=$next
|
||||
next=$DATE
|
||||
done
|
||||
}
|
||||
@@ -781,14 +802,24 @@ function commitsByMonth() {
|
||||
# OUTS: None
|
||||
################################################################################
|
||||
function commitsByWeekday() {
|
||||
optionPicked "Git commits by weekday:"
|
||||
local author="${1:-}"
|
||||
local _author=""
|
||||
|
||||
if [[ -z "${author}" ]]; then
|
||||
optionPicked "Git commits by weekday:"
|
||||
_author="--author=**"
|
||||
else
|
||||
optionPicked "Git commits by weekday for author '${author}':"
|
||||
_author="--author=${author}"
|
||||
fi
|
||||
|
||||
echo -e "\tday\tsum"
|
||||
local i counter=1
|
||||
for i in Mon Tue Wed Thu Fri Sat Sun
|
||||
do
|
||||
echo -en "\t$counter\t$i\t"
|
||||
git -c log.showSignature=false shortlog -n $_merges --format='%ad %s' \
|
||||
"$_since" "$_until" $_log_options |
|
||||
"${_author}" "$_since" "$_until" $_log_options |
|
||||
grep -cE "^ * $i \w\w\w [0-9]{1,2} " || continue
|
||||
counter=$((counter+1))
|
||||
done | awk '{
|
||||
@@ -874,9 +905,9 @@ function commitsByTimezone() {
|
||||
fi
|
||||
|
||||
echo -e "Commits\tTimeZone"
|
||||
git -c log.showSignature=false shortlog -n $_merges --format='%ad %s' \
|
||||
git -c log.showSignature=false log $_merges --format='%ad %s' \
|
||||
"${_author}" "$_since" "$_until" --date=iso $_log_options $_pathspec \
|
||||
| cut -d " " -f 12 | grep -v -e '^[[:space:]]*$' | sort | uniq -c
|
||||
| cut -d " " -f 3 | grep -v -e '^[[:space:]]*$' | sort -n | uniq -c
|
||||
}
|
||||
|
||||
################################################################################
|
||||
@@ -961,6 +992,12 @@ if [[ "$#" -eq 1 ]]; then
|
||||
-Y|--commits-by-year ) commitsByYear;;
|
||||
-m|--commits-by-month) commitsByMonth;;
|
||||
-w|--commits-by-weekday) commitsByWeekday;;
|
||||
-W|--commits-by-author-by-weekday)
|
||||
author="${_GIT_AUTHOR:-}"
|
||||
while [[ -z "${author}" ]]; do
|
||||
read -r -p "Which author? " author
|
||||
done
|
||||
commitsByWeekday "${author}";;
|
||||
-o|--commits-by-hour) commitsByHour;;
|
||||
-A|--commits-by-author-by-hour)
|
||||
author="${_GIT_AUTHOR:-}"
|
||||
@@ -1034,19 +1071,24 @@ while [[ "${opt}" != "" ]]; do
|
||||
13) commitsByMonth; showMenu;;
|
||||
14) commitsByYear; showMenu;;
|
||||
15) commitsByWeekday; showMenu;;
|
||||
16) commitsByHour; showMenu;;
|
||||
17) author=""
|
||||
16) author=""
|
||||
while [[ -z "${author}" ]]; do
|
||||
read -r -p "Which author? " author
|
||||
done
|
||||
commitsByWeekday "${author}"; showMenu;;
|
||||
17) commitsByHour; showMenu;;
|
||||
18) author=""
|
||||
while [[ -z "${author}" ]]; do
|
||||
read -r -p "Which author? " author
|
||||
done
|
||||
commitsByHour "${author}"; showMenu;;
|
||||
18) commitsByTimezone; showMenu;;
|
||||
19) author=""
|
||||
19) commitsByTimezone; showMenu;;
|
||||
20) author=""
|
||||
while [[ -z "${author}" ]]; do
|
||||
read -r -p "Which author? " author
|
||||
done
|
||||
commitsByTimezone "${author}"; showMenu;;
|
||||
20) suggestReviewers; showMenu;;
|
||||
21) suggestReviewers; showMenu;;
|
||||
q|"\n") exit;;
|
||||
*) clear; optionPicked "Pick an option from the menu"; showMenu;;
|
||||
esac
|
||||
|
||||
@@ -95,6 +95,11 @@ displays a list of commits per year
|
||||
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
|
||||
|
||||
@@ -52,6 +52,8 @@ LIST OPTIONS
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user