1,指定作者, 指定时间的代码量统计:
git log --since="2021-03-01" --before="2022-01-09" --author="xz_username" --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 }'
2,每人的代码量统计:
git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --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 }' -; done
3,根据时间,每人的代码量统计:
git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --since=2022-06-14 --before=2022-06-15 --author="$name" --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 }' -; done