Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: get number of changed lines per day

Tags:

git

I'd like to make a diagram of added/removed/changed lines in a git repository per day and/or week. I do not want to count the number of commits.

Is there a tool that can produce such charts (gitstats does not)? Or, with which git command I can produce an output which i could parse easily?

Thank you!

like image 851
ernesto Avatar asked Nov 16 '11 15:11

ernesto


1 Answers

Maybe something like this:

$ git diff --shortstat "@{1 month ago}"   7 files changed, 29 insertions(+), 6 deletions(-) 

(As you can see, I tried this on a pretty stale repository.)

Note that this will compare the current working directory to what the current branch pointed to one month ago on your local machine.

Edit: To get stats for all commits on the branch master in a certain date range, you can use

git log --after=2011-01-01 --before=2011-01-31 --format=format: --shortstat master 
like image 80
Sven Marnach Avatar answered Sep 20 '22 13:09

Sven Marnach