mirror of
https://github.com/git-quick-stats/git-quick-stats.git
synced 2025-12-16 12:00:12 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
481bc47482 | ||
|
|
29bbc98c87 | ||
|
|
f344f0dfb7 | ||
|
|
8b24e28c95 | ||
|
|
745b995f30 | ||
|
|
1a7abe3132 | ||
|
|
5a55f87ad7 | ||
|
|
11c1a9ff5c | ||
|
|
06563a2170 | ||
|
|
2e9b163766 | ||
|
|
8558eef324 | ||
|
|
6d0e1aa692 | ||
|
|
27f0857b77 |
21
README.md
21
README.md
@@ -32,6 +32,8 @@ Or you can use (non-interactive) direct execution:
|
|||||||
branchTree, branchesByDate, changelogs
|
branchTree, branchesByDate, changelogs
|
||||||
|
|
||||||
|
|
||||||
|
#### Git log --since and --until arguments
|
||||||
|
|
||||||
You can set variable `_GIT_SINCE`, `_GIT_UNTIL` and limit the git log
|
You can set variable `_GIT_SINCE`, `_GIT_UNTIL` and limit the git log
|
||||||
|
|
||||||
eg:
|
eg:
|
||||||
@@ -42,8 +44,20 @@ eg:
|
|||||||
|
|
||||||
then run `git quick-stats` (affect all stats, except "My daily status" and "Git changelogs" )
|
then run `git quick-stats` (affect all stats, except "My daily status" and "Git changelogs" )
|
||||||
|
|
||||||
|
|
||||||
|
#### Git log limit
|
||||||
|
|
||||||
|
You can set variable `_GIT_LIMIT` for limited output (it will affect: "Git changelogs" and "Branch tree view" )
|
||||||
|
|
||||||
|
eg:
|
||||||
|
|
||||||
|
`export _GIT_LIMIT=20`
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
#### Unix like OS
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/arzzen/git-quick-stats.git && cd git-quick-stats
|
git clone https://github.com/arzzen/git-quick-stats.git && cd git-quick-stats
|
||||||
sudo make install
|
sudo make install
|
||||||
@@ -55,11 +69,16 @@ For uninstalling, open up the cloned directory and run
|
|||||||
sudo make uninstall
|
sudo make uninstall
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Cygwin installation
|
#### OS X (homebrew)
|
||||||
|
|
||||||
|
`brew install git-quick-stats`
|
||||||
|
|
||||||
|
#### Windows (cygwin)
|
||||||
|
|
||||||
* [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)
|
||||||
|
|
||||||
|
|
||||||
## System requirements
|
## System requirements
|
||||||
|
|
||||||
* Unix like OS with a proper shell
|
* Unix like OS with a proper shell
|
||||||
|
|||||||
@@ -13,6 +13,18 @@ if [ ! -z ${_until} ]
|
|||||||
then _until="--until=$_until"
|
then _until="--until=$_until"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
_pathspec=${_GIT_PATHSPEC:-}
|
||||||
|
if [ ! -z "${_pathspec}" ]
|
||||||
|
then _pathspec="-- . $_pathspec"
|
||||||
|
fi
|
||||||
|
|
||||||
|
_limit=${_GIT_LIMIT:-}
|
||||||
|
if [ ! -z ${_limit} ]
|
||||||
|
then _limit=$_limit
|
||||||
|
else
|
||||||
|
_limit=10
|
||||||
|
fi
|
||||||
|
|
||||||
show_menu() {
|
show_menu() {
|
||||||
NORMAL=`echo "\033[m"`
|
NORMAL=`echo "\033[m"`
|
||||||
MENU=`echo "\033[36m"`
|
MENU=`echo "\033[36m"`
|
||||||
@@ -24,10 +36,10 @@ show_menu() {
|
|||||||
echo -e ""
|
echo -e ""
|
||||||
echo -e "${RED_TEXT} Generate: ${NORMAL}"
|
echo -e "${RED_TEXT} Generate: ${NORMAL}"
|
||||||
echo -e "${MENU} ${NUMBER} 1)${MENU} Contribution stats (by author) ${NORMAL}"
|
echo -e "${MENU} ${NUMBER} 1)${MENU} Contribution stats (by author) ${NORMAL}"
|
||||||
echo -e "${MENU} ${NUMBER} 2)${MENU} Git changelogs ${NORMAL}"
|
echo -e "${MENU} ${NUMBER} 2)${MENU} Git changelogs (last $_limit)${NORMAL}"
|
||||||
echo -e "${MENU} ${NUMBER} 3)${MENU} My daily status ${NORMAL}"
|
echo -e "${MENU} ${NUMBER} 3)${MENU} My daily status ${NORMAL}"
|
||||||
echo -e "${RED_TEXT} List: ${NORMAL}"
|
echo -e "${RED_TEXT} List: ${NORMAL}"
|
||||||
echo -e "${MENU} ${NUMBER} 4)${MENU} Branch tree view (last 10)${NORMAL}"
|
echo -e "${MENU} ${NUMBER} 4)${MENU} Branch tree view (last $_limit)${NORMAL}"
|
||||||
echo -e "${MENU} ${NUMBER} 5)${MENU} All branches (sorted by most recent commit) ${NORMAL}"
|
echo -e "${MENU} ${NUMBER} 5)${MENU} All branches (sorted by most recent commit) ${NORMAL}"
|
||||||
echo -e "${MENU} ${NUMBER} 6)${MENU} All contributors (sorted by name) ${NORMAL}"
|
echo -e "${MENU} ${NUMBER} 6)${MENU} All contributors (sorted by name) ${NORMAL}"
|
||||||
echo -e "${MENU} ${NUMBER} 7)${MENU} Git commits per author ${NORMAL}"
|
echo -e "${MENU} ${NUMBER} 7)${MENU} Git commits per author ${NORMAL}"
|
||||||
@@ -53,7 +65,7 @@ function option_picked() {
|
|||||||
function detailedGitStats() {
|
function detailedGitStats() {
|
||||||
option_picked "Contribution stats (by author):"
|
option_picked "Contribution stats (by author):"
|
||||||
|
|
||||||
git log --no-merges --numstat --pretty="format:commit %H%nAuthor: %an <%ae>%nDate: %ad%n%n%w(0,4,4)%B%n" $_since $_until | LC_ALL=C awk '
|
git log --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) {
|
function printStats(author) {
|
||||||
printf "\t%s:\n", author
|
printf "\t%s:\n", author
|
||||||
|
|
||||||
@@ -74,6 +86,7 @@ function detailedGitStats() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( first[author] != "" ) {
|
if ( first[author] != "" ) {
|
||||||
|
printf "\t lines changed: %s\n", more[author] + less[author]
|
||||||
printf "\t first commit: %s\n", first[author]
|
printf "\t first commit: %s\n", first[author]
|
||||||
printf "\t last commit: %s\n", last[author]
|
printf "\t last commit: %s\n", last[author]
|
||||||
}
|
}
|
||||||
@@ -115,7 +128,7 @@ function detailedGitStats() {
|
|||||||
|
|
||||||
function suggestReviewers() {
|
function suggestReviewers() {
|
||||||
option_picked "Suggested code reviewers (based on git history):"
|
option_picked "Suggested code reviewers (based on git history):"
|
||||||
git log --no-merges $_since $_until --pretty=%an $* | head -n 100 | sort | uniq -c | sort -nr | LC_ALL=C awk '
|
git log --no-merges $_since $_until --pretty=%an $_pathspec $* | head -n 100 | sort | uniq -c | 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) {
|
||||||
@@ -127,7 +140,7 @@ function suggestReviewers() {
|
|||||||
function commitsByMonth() {
|
function commitsByMonth() {
|
||||||
option_picked "Git commits by month:"
|
option_picked "Git commits by month:"
|
||||||
echo -e "\tmonth\tsum"
|
echo -e "\tmonth\tsum"
|
||||||
for i in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Dec
|
for i in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
|
||||||
do
|
do
|
||||||
echo -en "\t$i\t"
|
echo -en "\t$i\t"
|
||||||
echo $(git shortlog -n --no-merges --format='%ad %s' $_since $_until | grep " $i " | wc -l)
|
echo $(git shortlog -n --no-merges --format='%ad %s' $_since $_until | grep " $i " | wc -l)
|
||||||
@@ -137,12 +150,13 @@ function commitsByMonth() {
|
|||||||
}
|
}
|
||||||
END{
|
END{
|
||||||
for (month in count) {
|
for (month in count) {
|
||||||
s="";
|
s="|";
|
||||||
percent = ((count[month] / total) * 100) / 1.25;
|
percent = ((count[month] / total) * 100) / 1.25;
|
||||||
for (i = 1; i <= percent; ++i) {
|
for (i = 1; i <= percent; ++i) {
|
||||||
s=s"="
|
s=s"█"
|
||||||
}
|
}
|
||||||
printf( "\t%s\t%-0s\t|%s\n", month, count[month], s );
|
|
||||||
|
printf( "\t%s\t%-0s\t%s\n", month, count[month], s );
|
||||||
}
|
}
|
||||||
}' | LC_TIME="en_EN.UTF-8" sort -M
|
}' | LC_TIME="en_EN.UTF-8" sort -M
|
||||||
}
|
}
|
||||||
@@ -154,24 +168,25 @@ function commitsByWeekday() {
|
|||||||
do
|
do
|
||||||
echo -en "\t$i\t"
|
echo -en "\t$i\t"
|
||||||
echo $(git shortlog -n --no-merges --format='%ad %s' $_since $_until | grep "$i " | wc -l)
|
echo $(git shortlog -n --no-merges --format='%ad %s' $_since $_until | grep "$i " | wc -l)
|
||||||
done | awk '{
|
done | awk '{
|
||||||
|
|
||||||
}
|
}
|
||||||
NR == FNR {
|
NR == FNR {
|
||||||
count[$1] = $2;
|
count[$1] = $2;
|
||||||
total += $2;
|
total += $2;
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
END{
|
END{
|
||||||
|
|
||||||
for (day in count) {
|
for (day in count) {
|
||||||
s="";
|
s="|";
|
||||||
percent = ((count[day] / total) * 100) / 1.25;
|
percent = ((count[day] / total) * 100) / 1.25;
|
||||||
for (i = 1; i <= percent; ++i) {
|
for (i = 1; i <= percent; ++i) {
|
||||||
s=s"="
|
s=s"█"
|
||||||
}
|
}
|
||||||
printf( "\t%s\t%-0s\t|%s\n", day, count[day], s );
|
printf( "\t%s\t%-0s\t%s\n", day, count[day], s );
|
||||||
}
|
}
|
||||||
}'
|
}' | sort -k 2 -n -r
|
||||||
}
|
}
|
||||||
|
|
||||||
function commitsByHour() {
|
function commitsByHour() {
|
||||||
@@ -187,19 +202,19 @@ function commitsByHour() {
|
|||||||
}
|
}
|
||||||
END{
|
END{
|
||||||
for (hour in count) {
|
for (hour in count) {
|
||||||
s="";
|
s="|";
|
||||||
percent = ((count[hour] / total) * 100) / 1.25;
|
percent = ((count[hour] / total) * 100) / 1.25;
|
||||||
for (i = 1; i <= percent; ++i) {
|
for (i = 1; i <= percent; ++i) {
|
||||||
s=s"="
|
s=s"█"
|
||||||
}
|
}
|
||||||
printf( "\t%s\t%-0s\t|%s\n", hour, count[hour], s );
|
printf( "\t%s\t%-0s\t%s\n", hour, count[hour], s );
|
||||||
}
|
}
|
||||||
}' | sort
|
}' | sort
|
||||||
}
|
}
|
||||||
|
|
||||||
function commitsPerDay() {
|
function commitsPerDay() {
|
||||||
option_picked "Git commits per date:";
|
option_picked "Git commits per date:";
|
||||||
git log --no-merges $_since $_until --date=short --format='%ad' | sort | uniq -c
|
git log --no-merges $_since $_until --date=short --format='%ad' $_pathspec | sort | uniq -c
|
||||||
}
|
}
|
||||||
|
|
||||||
function commitsPerAuthor() {
|
function commitsPerAuthor() {
|
||||||
@@ -228,12 +243,12 @@ function myDailyStats() {
|
|||||||
|
|
||||||
function contributors() {
|
function contributors() {
|
||||||
option_picked "All contributors (sorted by name):"
|
option_picked "All contributors (sorted by name):"
|
||||||
git log --no-merges $_since $_until --format='%aN' | sort -u | cat -n
|
git log --no-merges $_since $_until --format='%aN' $_pathspec | sort -u | cat -n
|
||||||
}
|
}
|
||||||
|
|
||||||
function branchTree() {
|
function branchTree() {
|
||||||
option_picked "Branching tree view:"
|
option_picked "Branching tree view:"
|
||||||
git log --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 50
|
git log --graph --abbrev-commit $_since $_until --decorate --format=format:'--+ Commit: %h %n | Date: %aD (%ar) %n'' | Message: %s %d %n'' + Author: %an %n' --all $_exclude | head -n $((_limit*5))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -244,7 +259,14 @@ function branchesByDate() {
|
|||||||
|
|
||||||
function changelogs() {
|
function changelogs() {
|
||||||
option_picked "Git changelogs:"
|
option_picked "Git changelogs:"
|
||||||
git log --pretty=format:"- %s%n%b" --since="$(git show -s --format=%ad `git rev-list --all --max-count=1`)" | sort -nr
|
NEXT=$(date +%F)
|
||||||
|
|
||||||
|
git log --no-merges --format="%cd" --date=short $_since $_until $_pathspec | sort -u -r | head -n $_limit | while read DATE ; do
|
||||||
|
echo
|
||||||
|
echo "[$DATE]"
|
||||||
|
GIT_PAGER=cat git log --no-merges --format=" * %s" --since=$DATE --until=$NEXT
|
||||||
|
NEXT=$DATE
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if we are currently in a git repo.
|
# Check if we are currently in a git repo.
|
||||||
@@ -330,7 +352,7 @@ while [ opt != '' ]
|
|||||||
;;
|
;;
|
||||||
5)
|
5)
|
||||||
branchesByDate
|
branchesByDate
|
||||||
show_menu
|
show_menu
|
||||||
;;
|
;;
|
||||||
6)
|
6)
|
||||||
contributors
|
contributors
|
||||||
@@ -361,13 +383,13 @@ while [ opt != '' ]
|
|||||||
show_menu
|
show_menu
|
||||||
;;
|
;;
|
||||||
q)
|
q)
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
\n)
|
\n)
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
clear
|
clear
|
||||||
option_picked "Pick an option from the menu"
|
option_picked "Pick an option from the menu"
|
||||||
show_menu
|
show_menu
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in New Issue
Block a user