• Git 代码统计


    •   代码提交作者
    git log --pretty='%aN' | sort -u
    •   代码提交作者个数
    git log --pretty='%aN' | sort -u | wc -l
    •       统计某个yourName的增加,删除,总行数
    git log --author="yourName" --pretty=tformat: --numstat | gawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s
    ", add, subs, loc }'
    •      提交次数top10
    git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r | head -n 10
    •     统计每个人,和上面统计结果一样,亲测非亲写(搬运工),单行脚本,自己感受下:
    git log --shortstat --pretty="%cE" | sed 's/(.*)@.*/1/' | grep -v "^$" | awk 'BEGIN { line=""; } !/^ / { if (line=="" || !match(line, $0)) {line = $0 "," line }} /^ / { print line " # " $0; line=""}' | sort | sed -E 's/# //;s/ files? changed,//;s/([0-9]+) ([0-9]+ deletion)/1 0 insertions(+), 2/;s/(+)$/(+), 0 deletions(-)/;s/insertions?(+), //;s/ deletions?(-)//' | awk 'BEGIN {name=""; files=0; insertions=0; deletions=0;} {if ($1 != name && name != "") { print name ": " files " files changed, " insertions " insertions(+), " deletions " deletions(-), " insertions-deletions " net"; files=0; insertions=0; deletions=0; name=$1; } name=$1; files+=$2; insertions+=$3; deletions+=$4} END {print name ": " files " files changed, " insertions " insertions(+), " deletions " deletions(-), " insertions-deletions " net";}'
  • 相关阅读:
    一、代码风格
    Nginx之Eclipse开发环境配置
    Linux之tail命令实时收集[纠正误解]
    Java之"Mozilla Rhino"引擎(二)
    linux之tail -F命令异常file truncated
    Java之nio性能比较
    Java之nio MappedByteBuffer的资源释放问题
    Java之java.lang.IllegalMonitorStateException
    Java之线程池管理
    Java之NIO传输数据
  • 原文地址:https://www.cnblogs.com/lioa/p/12074127.html
Copyright © 2020-2023  润新知