GIT统计提交次数等信息的方法(年终总结报告常常需要的数据)
统计git提交次数: 所有人的所有提交次数,会展示所有的提交人 提交次数详情。
git log | grep "^Author: " | awk '{print $2}' | sort | uniq -c | sort -k1,1nr统计时间内提交次数。
git log --author=joyber --after="2023-01-01" --before="2023-12-31" --no-merges | grep -e 'commit [a-zA-Z0-9]*' | wc -l统计时间内提交的备注内容(只保留提交时间和备注内容),放到桌面。
git log --author=joyber --after="2023-01-01" --before="2023-12-31" --no-merges | grep -v '^commit' | grep -v '^Author' > ~/Desktop/gitstat.txt统计时间内提交的备注内容(只保留备注内容),放到桌面。
git log --author=joyber --after="2023-01-01" --before="2023-12-31" --no-merges | grep -v '^commit' | grep -v '^Author' | grep -v '^Date' > ~/Desktop/gitstat1.txt去除连续提交的重复多次的相同内容
cat gitstat1.txt | grep -v '^$' | uniq > gitstat2.txt先排序,再去除重复的行
sort -u gitstat1.txt > gitstat2.txt
#or
sort gitstat1.txt | uniq > gitstat2.txt统计提交行数:根据1展示出详情,可以填入username。将展示该用户增加行数,删减行数,剩余行数。
git log --author="joyber" --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 }' -版权属于:Joyber
本文链接:https://blog.qqvbc.com/default/920.html
转载时须注明出处及本声明