Created
December 27, 2022 13:59
-
-
Save discountry/dd276833eec6a4127117e89b69ff0d43 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 "添加行数: %s, 删除的行数: %s, 代码总行数: %s\n", add, subs, loc }' -; done |
Author
discountry
commented
Dec 27, 2022
Author
git ls-files -z |
xargs -0rn 1 -P "$(nproc)" -I{} sh -c 'git blame -w -M -C -C --line-porcelain -- {} | grep -I --line-buffered "^author "' |
sort -f |
uniq -ic |
sort -n
Author
rankNumber=10
filterNumber=3
cd ./project1
git ls-files | while read f; do git blame -w --line-porcelain -- "$f" | grep -I '^author '; done | sort -f | uniq -ic | sort -k2 -gr > ../rank.txt
cd ../project2
git ls-files | while read f; do git blame -w --line-porcelain -- "$f" | grep -I '^author '; done | sort -f | uniq -ic | sort -k2 -gr | awk "NR<${filterNumber+1}" >> ../rank.txt
cd ../
cat rank.txt | sort -k2 -gr | awk "NR<${rankNumber+1}"
Author
rankNumber=5
PROJECTS_LIST=('~/project1' '~/project12')
for project in "${PROJECTS_LIST[@]}"
do
cd $project
git ls-files | while read f; do git blame -w --line-porcelain -- "$f" | grep -I '^author '; done | sort -f | uniq -ic | sort -k2 -gr >> ~/rank.txt
done
cat ~/rank.txt | sort -k2 -gr | awk "NR<$rankNumber+1"
rm ~/rank.txt
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment