Windows系统进入项目目录下(包含.git的目录),右击空白处,点击Git Bash Here

1.统计sujing在某个时间段内的git新增/删除代码行数
git log --author=LPLambert --since=2021-01-01 --until=2021-12-30 --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --numstat | grep "\(.html\|.java\|.xml\|.properties\)$" | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done

2.统计该项目所有的代码数
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 }'

本文档指导如何使用Git Bash在Windows系统中统计指定作者在特定时间段内新增和删除的代码行数,同时展示了统计整个项目所有代码行的方法。
4712





