git统计项目代码修改行数
1、前往git本地项目路径下 2、右键打开(Git Bash)工具 3、输入以下命令进行不同方式统计
根据用户名进行统计
git log --author="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 }'
根据时间段进行统计
git log --since=2022-01-01 --until=2022-12-31 --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 log --author="username" --since=2022-01-01 --until=2022-12-31 \
--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 }'
|