git 按時間列印所有成員代碼送出:
git log --since ==2018-01-01 --until=2018-12-31 --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 + $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done
單個成員查詢:
git log --since=2018-01-01 --until=2018-12-31 --author="DENA\chuanyong.zhu" --pretty=tformat: --numstat | awk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "added lines: %s removed lines : %s total lines: %s\n",add,subs,loc }' -
以上是git指令,以下介紹一下gitstats:
1.example
2.安裝
a.安裝gitstats
git clone git://github.com/hoxu/gitstats.git
b.安裝brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
c.安裝gnuplot畫圖程式
brew install gnuplot
d.運作指令
cd xxx/gitstats
python gitstats Documents/gitxxx Documents/gitoutput
xxx/gitstats 為gitstats的本地clone位址
Documents/gitxxx 為本地代碼倉庫路徑
Documents/gitoutput 為生成報表位置
更多:
https://segmentfault.com/a/1190000008542123
解決問題的能力很關鍵~(iOS開發交流群:219926126)