-
统计项目内所有代码行数
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 -
统计项目内指定时间指定作者的代码行数
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
07-11
1833
01-30
1万+