mirror of
https://github.com/git-quick-stats/git-quick-stats.git
synced 2025-12-16 12:00:12 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
258b52eda8 | ||
|
|
187c03ae98 | ||
|
|
5e00e35a30 | ||
|
|
c107529335 |
4
Makefile
4
Makefile
@@ -19,6 +19,7 @@ install:
|
||||
mkdir -p $(PREFIX)/bin
|
||||
install -m 0755 $(EXEC_FILES) $(PREFIX)/bin/$(EXEC_FILES)
|
||||
git config --global alias.quick-stats '! $(PREFIX)/bin/$(EXEC_FILES)'
|
||||
$(MAKE) man
|
||||
@$(TASK_DONE)
|
||||
|
||||
uninstall:
|
||||
@@ -34,6 +35,9 @@ reinstall:
|
||||
$(MAKE) install
|
||||
@$(TASK_DONE)
|
||||
|
||||
man:
|
||||
install -g 0 -o 0 -m 0644 git-quick-stats.1 /usr/share/man/man1/
|
||||
|
||||
test:
|
||||
tests/commands_test.sh
|
||||
@$(TASK_DONE)
|
||||
|
||||
@@ -137,7 +137,7 @@ function option_picked() {
|
||||
|
||||
function detailedGitStats() {
|
||||
option_picked "Contribution stats (by author):"
|
||||
git log --use-mailmap --no-merges --numstat --pretty="format:commit %H%nAuthor: %aN <%aE>%nDate: %ad%n%n%w(0,4,4)%B%n" $_since $_until $_pathspec | LC_ALL=C awk '
|
||||
git -c log.showSignature=false log --use-mailmap --no-merges --numstat --pretty="format:commit %H%nAuthor: %aN <%aE>%nDate: %ad%n%n%w(0,4,4)%B%n" $_since $_until $_pathspec | LC_ALL=C awk '
|
||||
function printStats(author) {
|
||||
printf "\t%s:\n", author
|
||||
|
||||
@@ -201,7 +201,7 @@ function detailedGitStats() {
|
||||
|
||||
function suggestReviewers() {
|
||||
option_picked "Suggested code reviewers (based on git history):"
|
||||
git log --use-mailmap --no-merges $_since $_until --pretty=%aN $_pathspec $* | head -n 100 | sort | uniq -c | sort -nr | LC_ALL=C awk '
|
||||
git -c log.showSignature=false log --use-mailmap --no-merges $_since $_until --pretty=%aN $_pathspec $* | head -n 100 | sort | uniq -c | sort -nr | LC_ALL=C awk '
|
||||
{ args[NR] = $0; }
|
||||
END {
|
||||
for (i = 1; i <= NR; ++i) {
|
||||
@@ -216,7 +216,7 @@ function commitsByMonth() {
|
||||
for i in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
|
||||
do
|
||||
echo -en "\t$i\t"
|
||||
git shortlog -n --no-merges --format='%ad %s' $_since $_until | grep " $i " | wc -l
|
||||
git -c log.showSignature=false shortlog -n --no-merges --format='%ad %s' $_since $_until | grep " $i " | wc -l
|
||||
done | awk '{
|
||||
count[$1] = $2
|
||||
total += $2
|
||||
@@ -241,7 +241,7 @@ function commitsByWeekday() {
|
||||
for i in Mon Tue Wed Thu Fri Sat Sun
|
||||
do
|
||||
echo -en "\t$i\t"
|
||||
git shortlog -n --no-merges --format='%ad %s' $_since $_until | grep "$i " | wc -l
|
||||
git -c log.showSignature=false shortlog -n --no-merges --format='%ad %s' $_since $_until | grep "$i " | wc -l
|
||||
done | awk '{
|
||||
|
||||
}
|
||||
@@ -280,7 +280,7 @@ function commitsByHour() {
|
||||
for i in $(seq -w 0 23)
|
||||
do
|
||||
echo -ne "\t$i\t"
|
||||
git shortlog -n --no-merges --format='%ad %s' "${_author}" $_since $_until | grep ' '$i: | wc -l
|
||||
git -c log.showSignature=false shortlog -n --no-merges --format='%ad %s' "${_author}" $_since $_until | grep ' '$i: | wc -l
|
||||
done | awk '{
|
||||
count[$1] = $2
|
||||
total += $2
|
||||
@@ -301,12 +301,12 @@ function commitsByHour() {
|
||||
|
||||
function commitsPerDay() {
|
||||
option_picked "Git commits per date:";
|
||||
git log --use-mailmap --no-merges $_since $_until --date=short --format='%ad' $_pathspec | sort | uniq -c
|
||||
git -c log.showSignature=false log --use-mailmap --no-merges $_since $_until --date=short --format='%ad' $_pathspec | sort | uniq -c
|
||||
}
|
||||
|
||||
function commitsPerAuthor() {
|
||||
option_picked "Git commits per author:"
|
||||
git shortlog $_since $_until --no-merges -n -s | sort -nr | LC_ALL=C awk '
|
||||
git -c log.showSignature=false shortlog $_since $_until --no-merges -n -s | sort -nr | LC_ALL=C awk '
|
||||
{ args[NR] = $0; sum += $0 }
|
||||
END {
|
||||
for (i = 1; i <= NR; ++i) {
|
||||
@@ -325,17 +325,17 @@ function myDailyStats() {
|
||||
}
|
||||
}'
|
||||
|
||||
echo -e "\t" $(git log --use-mailmap --author="$(git config user.name)" --no-merges --since=$(date "+%Y-%m-%dT00:00:00") --until=$(date "+%Y-%m-%dT23:59:59") --reverse | grep commit | wc -l) "commits"
|
||||
echo -e "\t" $(git -c log.showSignature=false log --use-mailmap --author="$(git config user.name)" --no-merges --since=$(date "+%Y-%m-%dT00:00:00") --until=$(date "+%Y-%m-%dT23:59:59") --reverse | grep commit | wc -l) "commits"
|
||||
}
|
||||
|
||||
function contributors() {
|
||||
option_picked "All contributors (sorted by name):"
|
||||
git log --use-mailmap --no-merges $_since $_until --format='%aN' $_pathspec | sort -u | cat -n
|
||||
git -c log.showSignature=false log --use-mailmap --no-merges $_since $_until --format='%aN' $_pathspec | sort -u | cat -n
|
||||
}
|
||||
|
||||
function branchTree() {
|
||||
option_picked "Branching tree view:"
|
||||
git log --use-mailmap --graph --abbrev-commit $_since $_until --decorate --format=format:'--+ Commit: %h %n | Date: %aD (%ar) %n'' | Message: %s %d %n'' + Author: %aN %n' --all | head -n $((_limit*5))
|
||||
git -c log.showSignature=false log --use-mailmap --graph --abbrev-commit $_since $_until --decorate --format=format:'--+ Commit: %h %n | Date: %aD (%ar) %n'' | Message: %s %d %n'' + Author: %aN %n' --all | head -n $((_limit*5))
|
||||
}
|
||||
|
||||
|
||||
@@ -357,10 +357,10 @@ function changelogs() {
|
||||
fi
|
||||
|
||||
NEXT=$(date +%F)
|
||||
git log --use-mailmap --no-merges --format="%cd" --date=short "${_author}" $_since $_until $_pathspec | sort -u -r | head -n $_limit | while read DATE ; do
|
||||
git -c log.showSignature=false log --use-mailmap --no-merges --format="%cd" --date=short "${_author}" $_since $_until $_pathspec | sort -u -r | head -n $_limit | while read DATE ; do
|
||||
echo
|
||||
echo "[$DATE]"
|
||||
GIT_PAGER=cat git log --use-mailmap --no-merges --format=" * %s (%aN)" "${_author}" --since=$DATE --until=$NEXT
|
||||
GIT_PAGER=cat git -c log.showSignature=false log --use-mailmap --no-merges --format=" * %s (%aN)" "${_author}" --since=$DATE --until=$NEXT
|
||||
NEXT=$DATE
|
||||
done
|
||||
}
|
||||
|
||||
113
git-quick-stats.1
Normal file
113
git-quick-stats.1
Normal file
@@ -0,0 +1,113 @@
|
||||
.TH git-quick-stats "1" "January 2019" "git-quick-stats" "User Commands"
|
||||
.SH NAME
|
||||
.B git\-quick\-stats
|
||||
\- Simple and efficient way to access various stats in a git repository.
|
||||
.SH SYNOPSIS
|
||||
.PP
|
||||
For non\-interactive mode:
|
||||
.B git\-quick\-stats [OPTIONS]
|
||||
.PP
|
||||
For interactive mode:
|
||||
.B git-quick-stats
|
||||
.PP
|
||||
.SH DESCRIPTION
|
||||
.PP
|
||||
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.
|
||||
.PP
|
||||
.SH OPTIONS
|
||||
.HP
|
||||
\fB\-r\fR, \fB\-\-suggest\-reviewers\fR
|
||||
.IP
|
||||
show the best people to contact to review code
|
||||
.HP
|
||||
.PP
|
||||
.PP
|
||||
\fB\-T\fR, \fB\-\-detailed\-git\-stats\fR
|
||||
.IP
|
||||
give a detailed list of git stats
|
||||
.HP
|
||||
.PP
|
||||
\fB\-d\fR, \fB\-\-commits\-per\-day\fR
|
||||
.IP
|
||||
displays a list of commits per day
|
||||
.HP
|
||||
.PP
|
||||
\fB\-m\fR, \fB\-\-commits\-by\-month\fR
|
||||
.IP
|
||||
displays a list of commits per month
|
||||
.HP
|
||||
.PP
|
||||
\fB\-w\fR, \fB\-\-commits\-by\-weekday\fR
|
||||
.IP
|
||||
displays a list of commits per weekday
|
||||
.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\-a\fR, \fB\-\-commits\-per\-author\fR
|
||||
.IP
|
||||
displays a list of commits per author
|
||||
.HP
|
||||
.PP
|
||||
\fB\-S\fR, \fB\-\-my\-daily\-stats\fR
|
||||
.IP
|
||||
see your current daily stats
|
||||
.HP
|
||||
.PP
|
||||
\fB\-C\fR, \fB\-\-contributors\fR
|
||||
.IP
|
||||
see a list of everyone who contributed to the repo
|
||||
.HP
|
||||
.PP
|
||||
\fB\-b\fR, \fB\-\-branch\-tree\fR
|
||||
.IP
|
||||
show an ASCII graph of the git repo branch history
|
||||
.HP
|
||||
.PP
|
||||
\fB\-D\fR, \fB\-\-branches\-by\-date\fR
|
||||
.IP
|
||||
show branches by date
|
||||
.HP
|
||||
.PP
|
||||
\fB\-c\fR, \fB\-\-changelogs\fR
|
||||
.IP
|
||||
see changelogs
|
||||
.HP
|
||||
.PP
|
||||
\fB\-L\fR, \fB\-\-changelogs\-by\-author\fR
|
||||
.IP
|
||||
see changelogs by author
|
||||
.HP
|
||||
.PP
|
||||
\fB\-h\fR, \-?, \fB\-\-help\fR
|
||||
.IP
|
||||
display this help text in the terminal
|
||||
.PP
|
||||
.SH ADDITIONAL USAGE
|
||||
You can set _GIT_SINCE and _GIT_UNTIL to limit the git time log, example:
|
||||
.IP
|
||||
.PP
|
||||
.B export _GIT_SINCE="2017\-20\-01"
|
||||
.IP
|
||||
.PP
|
||||
You can set _GIT_LIMIT for limited output log, example:
|
||||
.PP
|
||||
.B export _GIT_LIMIT=20
|
||||
.PP
|
||||
You can exclude a directory from the stats by using pathspec, example:
|
||||
.PP
|
||||
.B export _GIT_PATHSPEC=':!directory'
|
||||
.
|
||||
.fi
|
||||
|
||||
Reference in New Issue
Block a user