git commad —— git ls-files —— 获取 文件 的修改信息

$ git ls-files | while read f; do git blame -w -M -C -C --line-porcelain "$f" | grep -I '^author '; done 

author CHN\123123
author CHN\123123
author CHN\123123
author CHN\123123

  

How do I show statistics for author's contributions in git?

 

相关资料:https://gist.github.com/Alpha59/4e9cd6c65f7aa2711b79#file-creditwherecreditisdue-sh

A very very slow one-liner that goes through a git blame and sees how many lines were contributed by each author.

 

# creditwherecreditisdue.sh
 
git ls-files -z | xargs -0n1 git blame -wfn | grep -v "test" | grep "\.(js|html)[^o]\s" | perl -n -e '/\((.*)\s[\d]{4}\-/ && print $1."\n"' | awk '{print $1" "$2" "$3}' | sort -f | uniq -c | sort -nr
 
# Lists the number of lines that an author has contributed to the code base.
# This also filters for !test and ==.js or .html (which was useful for this particular run)
 
# A Django version of the same thing:
git ls-files -z | xargs -0n1 git blame -wfn | grep -v "test" | grep -v "fixture" | grep -v "json" | grep -v "gpg" | grep -v ".md" | grep -v "initial_schema" | grep -v "fonts" | grep -v "min." | grep -v "migrations" | grep -v "images" | grep -v "/bootstrap" | grep -v "debug" | grep -v "/img" | grep -v "vendor" | perl -n -e '/\((.*)\s[\d]{4}\-/ && print $1."\n"' | awk '{print $1" "$2" "$3}' | sort -f | uniq -c | sort -nr
 
 
# removemergedbranches.sh
 
git branch --merged | grep -v `git rev-parse --abbrev-ref HEAD` | xargs git branch -d
 
# checkout your dev branch, and then clean up your local by running this to remove all merged branches.
 
# whatdidtheywrite.sh
 
git ls-files -z | xargs -0n1 git blame -wfn | awk '/<author>/{print $0}'
 
# I suggest only using this if the author has a small number of lines listed above.
# I also adjusted it to include the file name and line number.
 
 
# whatfilesdidtheychange.sh
 
git ls-files -z | xargs -0n1 git blame -wfn | awk '/<author>/{print $2}' | sort -f | uniq -c | sort -nr
 
# Lists out files that have been altered by a given author (including number of lines changed in that file).

  

posted @ 2022-02-15 12:04  PanPan003  阅读(70)  评论(0编辑  收藏  举报