Compare commits

...

5 Commits
1.0.2 ... 1.0.3

Author SHA1 Message Date
Lukas Mestan
5a55f87ad7 update readme 2017-02-22 20:11:26 +01:00
Lukas Mestan
11c1a9ff5c add limit option for changelogs & branch tree view 2017-02-22 20:05:05 +01:00
Lukáš Mešťan
06563a2170 🍺 homebrew installation 2017-02-21 21:09:47 +01:00
Lukas Mestan
2e9b163766 remove white spaces 2017-02-21 20:36:08 +01:00
Lukas Mestan
8558eef324 update readme 2017-02-21 19:20:44 +00:00
2 changed files with 45 additions and 12 deletions

View File

@@ -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

View File

@@ -13,6 +13,13 @@ if [ ! -z ${_until} ]
then _until="--until=$_until" then _until="--until=$_until"
fi 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 +31,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}"
@@ -154,9 +161,9 @@ 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;
@@ -233,7 +240,7 @@ function contributors() {
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 | head -n $((_limit*5))
} }
@@ -244,7 +251,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 | 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 +344,7 @@ while [ opt != '' ]
;; ;;
5) 5)
branchesByDate branchesByDate
show_menu show_menu
;; ;;
6) 6)
contributors contributors
@@ -361,13 +375,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
;; ;;