On Tue, Oct 31, 2023 at 5:49 AM Taylor Blau <me@xxxxxxxxxxxx> wrote: > > On Tue, Oct 17, 2023 at 07:37:46PM +0800, Hongyi Zhao wrote: > > I want to calculate a certain developer's contribution based on > > different standards of code line count and the importance of the code. > > I agree with brian that "number of lines added/removed" is not a perfect > measure of productivity ;-). > > But I think that there is a slightly cleaner way to compute the result > you're after, like so: > > git rev-list --author="$who" origin/main | > git diff-tree --stdin -r --numstat --no-commit-id | > awk '{ s += $1 + $2 } END { print s }' See below: werner@X10DAi:~/Public/repo/github.com/OrderN/CONQUEST-release.git$ git log --author="JianboLin" --stat --summary origin/f-mlff | awk 'NF ==4 && $2 =="|" && $3 ~/[0-9]+/ && $4 ~/[+-]+|[+]+|[-]+/ {s+=$3} END {print s}' 8519 werner@X10DAi:~/Public/repo/github.com/OrderN/CONQUEST-release.git$ git rev-list --author="JianboLin" origin/f-mlff | git diff-tree --stdin -r --numstat --no-commit-id | awk '{ s += $1 + $2 } END { print s }' 8519 So, your method and my original one give exactly the same result. Therefore, I can't see what their fundamental difference is. > Thanks, > Taylor Regards, Zhao