git统计代码行数

1、统计分支代码
git log  分支 --pretty=tformat:  --numstat  -- . ":(exclude)*/test/*" ":(exclude)*/mock/*" ":(exclude)*/dal/*" ":(exclude)*/model/*" ":(exclude)*/dto/*" ":(exclude)*/enum/*" ":(exclude)*/enums/*" | grep "\(.java\)$" | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'  
2、统计分支代码(时间:从2021-02-01到2022-02-01)
git log  分支 --since=2021-02-01 --until=2022-02-01 --pretty=tformat:  --numstat  -- . ":(exclude)*/test/*" ":(exclude)*/mock/*" ":(exclude)*/dal/*" ":(exclude)*/model/*" ":(exclude)*/dto/*" ":(exclude)*/enum/*" ":(exclude)*/enums/*" | grep "\(.java\)$" | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }'  

你可能感兴趣的:(java,git,p2p,蓝桥杯)