前言:
? ? ? ? 項目中通過git來提交代碼后,可以通過git log的不同命令來查看項目中各成員的代碼提交情況,行數(shù),次數(shù)。
具體操作:
1、查看所有的提交日志,回車查看更多,不過太多會卡死,需要重新開
git log
2、查詢項目中所有用戶的提交總次數(shù),
*這個命令只能用git的小黑框輸入,注意,復制的代碼,會多內(nèi)容,需要手動刪下
git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r
3、統(tǒng)計各用戶提交代碼行數(shù)
*這個命令只能用git的小黑框輸入,注意,復制的代碼,會多內(nèi)容,需要手動刪下
1)查詢項目中總數(shù)
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
2)根據(jù)指定時間查詢,2023-01-01 00:00:00 -?2023-12-31 23:59:59
git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --after="2023-01-01 00:00:00" --before="2023-12-31 23:59:59" --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)查詢指定用戶的代碼量(可用cmd彈框)
git log --author=" git上的名字 " --oneline --shortstat
4)指定用戶,在指定時間內(nèi)的代碼行數(shù)
ceshi? 改成你的git名字
since? 后面是開始時間文章來源:http://www.zghlxwxcb.cn/news/detail-850368.html
until? 后面是結束時間文章來源地址http://www.zghlxwxcb.cn/news/detail-850368.html
git log --author="ceshi" --since=2023-01-01 --until=2023-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查看項目中各成員的代碼提交情況,行數(shù),次數(shù)等的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!