git log --no-merges --shortstat --pretty=format:"%cd %an" --date=iso-strict > a.txt
统计代码量导出到 a 文件夹
(.+)\+08\:00 +(.*)\n (\d+) files? changed(, (\d+) insertions?\(\+\))?(, (\d+) deletions?\(\-\))?
$1\t$2\t$3\t$5\t$7
正则表达式替换
\n+
\n
空格换行替换
根据时间、用户分组 统计代码量
git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --since ==2020-07-07 --until==2020-09-28 --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
忽略静态文件,针对文件夹进行剔除
git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --since ==2020-07-07 --until==2020-09-28 --author="$name" --pretty=tformat: --numstat -- . ":(exclude)D:\workspace\nine_branch\mdgz\src\main\webapp" ":(exclude)D:\workspace\nine_branch\mdgz\src\main\webapp" | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done