5

In git, for a given date range and a given user, I'd like to find out:

1 - The total lines changed.

2 - The average lines changed per day.

Note: This question is not a duplicate of How to count total lines changed by a specific author in a git repository because the answers to that question don't limit the results by date. I'd like the results limited to a given date range. That question also doesn't address average lines changed per day at all.

izkon
  • 189
  • 1
  • 7
  • 1
    Possible duplicate of [How to count total lines changed by a specific author in a Git repository?](https://stackoverflow.com/questions/1265040/how-to-count-total-lines-changed-by-a-specific-author-in-a-git-repository) – Dmitry Oct 08 '17 at 10:54
  • Thanks, but the answers there don't limit the results to a given date range. They're all grand totals across all commits. – izkon Oct 08 '17 at 11:09

1 Answers1

12

For instance

git log --since=2017-01-01 --until=2017-06-01 --author="Jim" --format= --numstat | awk '{s+=$1; s+=$2} END {print s}'

gives me the sum of insertions and deletions for that timespan and author. For the average, this answer on unix.stackexchange looks fine to get the difference between two dates in days. The rest is trivial.

SVSchmidt
  • 6,269
  • 2
  • 26
  • 37