gitlab代码统计

gitlab代码统计

git log --format='%aN' | sort -u | while read name; do echo -en "$name	"; git log --author="$name" --pretty=tformat: --since ==2018–03-01 --until=2018-06-30 --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s
", add, subs, loc }' -; done
git log --author="username" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s
", add, subs, loc }' -

推荐gitstat,详情见链接

1 安装gitstat:

需要安装python

git clone git://github.com/hoxu/gitstats.git
 Debian
apt-get install gitstats
 Fedora
yum install gitstats
 OS X
brew install --HEAD homebrew/head-only/gitstats
  有更详细安装方法 http://gitstats.sourceforge.net/
2 使用:
  下载代码到code目录  
git clone ssh://xxxx@xxxx29418/xxxxx code
  使用gitstat工具分析code目录代码生成结果到result中
gitstats code result
  result下生产html分析报告
3 分析结果:
  常规的统计:文件总数,行数,提交量,作者数。
  活跃性:每天中每小时的、每周中每天的、每周中每小时的、每年中每月的、每年的提交量。
  作者数:列举所有的作者(提交数,第一次提交日期,最近一次的提交日期),并按月和年来划分。
  文件数:按日期划分,按扩展名名划分。
  行数:按日期划分。
4 linux代码的分析例子:
  http://gitstats.sourceforge.net/examples/linux-2.6/index.html

相关链接

https://www.cnblogs.com/fengjian2016/p/10873916.html
https://blog.csdn.net/qq_37023538/article/details/53930200
https://rzrobert.github.io/2017/02/04/git统计项目中各成员代码量/

原文地址:https://www.cnblogs.com/tomtellyou/p/13143169.html