0

I'm trying to find the number of lines authored by each user in the CURRENT code base, ignoring certain file types.

Things I tried:

  1. git shortlog -s shows commits, not lines

  2. How to count total lines changed by a specific author in a Git repository? git log --pretty=tformat: --numstat \ | gawk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s removed lines: %s total lines: %s\n", add, subs, loc }' - shows all users

  • "*…lines authored by each user…*" Git doesn't store enough information to reconstruct this. If the 1st user created a line, the 2nd user changed variable name and the 3rd user fixed a small bug in the line — to whom you'd attribute the line? – phd Dec 02 '21 at 11:22
  • 1
    Each commit has a specific author; you could count lines added and removed per author. However, this particular metric would (in my opinion at least) have nearly zero value. The most useful part of the metric would be to find who can remove the most code while retaining existing functions or adding a new feature. – torek Dec 02 '21 at 16:17
  • @phd, I'm willing to accept that risk and give all credit to the 3rd person. We had a teammate write buggy code. It took me a week to undo all his "contributions" after he was let go. – pizza_rat_matt Dec 03 '21 at 15:55
  • @torek, I'm thinking anything is better than nothing. I'm trying to evaluate my team's productivity. – pizza_rat_matt Dec 03 '21 at 15:56

0 Answers0