Git counts the number of lines of code submitted by individuals

1. Git counts the number of lines of code submitted by individuals

 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 "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done

Result graph:

Insert picture description here

This statistic is based on the current branch, so if it is an iterative change later, just count the latest branch.

2. Git statistics project total number of lines

 git log  --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -

Effect picture:

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_40985985/article/details/109177114