以下内容来源网络搜集:
- 列出贡献者名单:
git log --format='%aN' | sort -u
- 列出给定用户修改的文件数、增加的行数、删除的行数:
或:git log --shortstat --author="xxx" | grep -E "fil(e|es) changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed: ", files, "lines inserted: ", inserted, "lines deleted: ", deleted }'
git log --author="xxx" --pretty=tformat: --numstat | gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "added lines: %s removed lines : %s total lines: %s\n",add,subs,loc }' -
- 给出提交统计列表:
git shortlog -sn
- 列出仓库提交前5名:
git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r | head -n 5
- 统计时间区间内给定用户新增和删除的行数:
git log --pretty=tformat: --numstat --since=".$since." --until=".$until." --author=".$author | gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "added lines: %s removed lines : %s total lines: %s\n",add,subs,loc }' -