想了解更多关于开源的社区内容,请访问:
51CTO 开源基础软件社区
https://ost.51cto.com
当开发者每提交一笔Pull Request/Commit时,代码的种都会有代码修改量,统计包含新增了多少行代码、聊聊删除了多少行代码。社区这属于过程动态的代码的种统计方式。还可以统计仓库代码量,统计不关注提交过程,聊聊只关注存留的社区代码量。这属于静态的代码的种统计方式。每位开发者都会关注自己贡献的代码量,此文就总结下,各个代码量统计方式。
先看下git log相关的参数说明。
git log 参数说明
–numstat
Similar to --stat, but shows number of added and deleted lines in decimal notation and pathname without abbreviation, to make it more machine friendly. For binary files, outputs two
-
instead of saying 0 0
.–shortstat
Output only the last line of the --stat format containing total number of modified files, as well as number of added and deleted lines.
–stat
使用–stat参数主要可以在git log 的基础上输出文件增删改的统计数据。
$ git log --stat
commit fa71c098e2912b69a1c82348d403b3260f2dc64e (HEAD -> temp_temp)
Author: zz(责任编辑:探索)
四川省资阳市1—4月新签约项目41个 协议投资额247.86亿元
R星在《GTA Online》中加入《荒野大镖客》移植版广告
三星发布Exynos 1380/1330处理器:支持5G 5nm工艺
节能元件(08231.HK)发布公告:预计年度由亏转盈60万美元
多人生存对抗PVP 《沙盒与副本:英勇之地》steam全新版本上线
《Thirsty Suitors》发售日期预告 11月3日正式发售
皇朝家居(01198.HK)发布公告:年度归母净利同比下降89.2%