git倉庫按時間、成員等維度分析統計

git 按時間打印全部成員代碼提交:html

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

  

單個成員查詢:python

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命令,如下介紹一下gitstatsgit

1.examplegithub

2.安裝segmentfault

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  爲生成報表位置

  

 更多:ruby

 https://segmentfault.com/a/1190000008542123curl

相關文章
相關標籤/搜索