-
统计项目内所有代码行数
git log --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 }'
输出结果:
added lines: 165091, removed lines: 40765, total lines: 124326 -
统计项目内指定时间的代码行数
git log --since=2022-01-01 --until==2022-12-30 --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 }'
输出结果:
added lines: 66901, removed lines: 19314, total lines: 47587 -
统计项目内指定时间指定作者的代码行数文章来源:https://www.toymoban.com/news/detail-513790.html
git log --since==2022-12-29 --until==2022-12-30 --author="irving" --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 }'
输出结果:
added lines: 26, removed lines: 20, total lines: 6文章来源地址https://www.toymoban.com/news/detail-513790.html
到了这里,关于git 代码量统计的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!