Git: Get username vs number of lines for a particular file type in HEAD

278 Views Asked by At

I wanted to measure the number of lines of code for each developer in the tip of develop branch at this point of time for python files. How can I make that happen?

More like this: Initialise a counter for each developer to 0. For each python file in project, blame each line. Increment the counter of the respective developer.

I do not want the overall addition deletion numbers. Only what exists in the HEAD of the branch.

1

There are 1 best solutions below

1
On

Try this bash one-liner:

find -name '*.py' -type f -exec git annotate  -e -- {} \; | cut -f2 -d $'\t' | grep -oP '[^<>]{2,}' | sort | uniq -c

It outputs not names, but e-mails.