一. 查看个人代码行数
git log --author="username" --pretty=tformat: --numstat | awk '{ add += 2; loc += 2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -
二. 查看每个人项目提交代码行数
git log --format='%aN' | sort -u | while read name; do echo -en "name" --pretty=tformat: --numstat | awk '{ add += 2; loc += 2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done
三. 查看所有用户提交总行数
git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r
四. 统计某个用户一段时间内代码行数
git log --since="2023-10-01" --before="2023-11-1" --author="name" --pretty=tformat: --numstat | awk '{ add += 2; loc += 2 } END { printf "新增行数: %s, 移除行数: %s, 总行数: %s\n", add, subs, loc }'