Reputation: 43
I have a block of code from lines x to y, and I want to see the percentage of lines that were committed by someone.
I currently have a git blame -L x,y
which retrieves the number of commits for that block of code, but I want the lines of code that were written by each user for these (ideally in a format similar to the porcelain mode)
Upvotes: 1
Views: 58
Reputation: 16055
I interpreted the question as "how to get the number of lines per author in a given line range".
The command below will list number of lines per author and if you need percentages, you need to compute sum of lines and then divide each number with the sum to get the fraction:
git blame -L 1698,1721 -p path/to/file.ext | grep "^author " | sort | uniq -c
The format cannot obviously match the git blame --porcelain
mode because that mode outputs data per line of code and you want data per author.
Upvotes: 1