1、使用git log
cd /data/gitlab/gitlab/repositories/dataanalysis/ cd doc-center.git git log --since ==2019-01-01 --until=2019-01-01 | wc -l git log --author=yourname --since="2019-01-01" --no-merges | grep -e 'commit [a-zA-Z0-9]*' | wc -l git log --since="2019-01-01" --no-merges | grep -e 'commit [a-zA-Z0-9]*' | wc -l git log | grep "^Author: " | awk '{print $2}' | sort | uniq -c | sort -k1,1nr git log --author="用户名" --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 }' -
2、使用gitstats
gitstats /data/gitlab/gitlab/repositories/dataanalysis/doc-center.git /data/git_stat_html/doc-center
这个生成html统计页面,很方便看。还有个类似的产品是git_stats
提交次数git shortlog --numbered --summary
查看所有的commit数git log --oneline | wc -l
提交删除行数git log --author="$(git config --get user.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 }'
使用cloc统计代码行数给力: