0

I'm just wondering if there is any library, script, or any way to count the lines of code written by the user in a repo. I was looking for something like that for a while but I didn't find anything.

If there is nothing like this, maybe you have any idea how a script like this could be done?

programmer
  • 550
  • 2
  • 4
  • 25

1 Answers1

2

Okay I already found it right here -> How to count total lines changed by a specific author in a Git repository?

Summing it up, the best solution is to use this command

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

because you do not need to use any external libraries, and you can still easily get statistics about line changes in the project

programmer
  • 550
  • 2
  • 4
  • 25