Reputation: 698
I want to graph the # of new lines of code written each hour over the course of the day.
I'm aware of git diff, git log and they are very powerful for determining total # of lines committed to a branch. The --since="7am" option is really great as well.
Some of the git commands I'm utilizing are:
Total # of lines
git log --numstat --pretty="%H" master | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'
# lines additional in devel branch compared to master
git log --numstat --pretty="%H" master..devel | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'
# lines since a time of day
git log --since="7am" --format=format: --numstat | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("%d, -%d\n", plus, minus)}'
# lines currently uncommitted
git diff --stat | tail -1 | awk '{print $4}'
I've been struggling though with coming up with a way to track the # of new lines written in the past hour including uncommitted changes, across all branches in the current repo.
This may be more of a math problem.
Upvotes: 16
Views: 892