雪中送炭
锦上添花
查看某用户一天24小时的提交分布信息
git log --author="某个username" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }'
查看仓库 commit 前 10 名贡献者
git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r | head -n 10
统计每个人增删的行数
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
查看在当前仓库的上的个人代码量
git log --author="cuishuang" --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 show|head -1; git log --author='cuishuang' --format="%H %ai" | perl script.pl
script.pl如下:
1 | #!/usr/bin/perl |
参考:
原文链接: https://dashen.tech/2020/07/26/一些有用的git-log技巧/
版权声明: 转载请注明出处.