izkon
izkon

Reputation: 209

Git: Average and total lines changed in a date range

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.

Upvotes: 7

Views: 4724

Answers (1)

SVSchmidt
SVSchmidt

Reputation: 6517

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.

Upvotes: 14

Related Questions