Reputation: 1479
I found general statistics on git for all the time the repo has existed but I'm interested in doing something like:
git today
And get things like # of commits, # of lines , etc. broken down by author.
I am mostly interested in # of lines by current user.. I can combine the results of other things on my own
Upvotes: 3
Views: 996
Reputation: 67723
Here's a complete script based on RJo's answer:
#!/bin/bash
set -e
TMPDIR=.tmp.gitstat.$$
mkdir $TMPDIR
trap "rm -fr $TMPDIR" EXIT
gitstats -c commit_begin=$(git log --pretty=format:%h --since $(date +%Y-%m-%d):00:00 | tail -1) . $TMPDIR
lynx $TMPDIR/index.html
(obviously replace lynx with your preferred browser, and change the script to either wait for it, or not delete the created directory, if it runs in the background).
Note there's no error checking, and specifically gitstats chokes if there's only one commit (git shortlog -s COMMIT..HEAD
must be non-empty).
Upvotes: 1
Reputation: 16291
If you want to see a graphical representation of a git repository's activity, use the gitstats
utility: http://gitstats.sourceforge.net/
All the following commands assume use of, e.g., bash. By running the following command you can get the first commit that has the same date as today.
> first_commit=`git log --pretty=format:"%h" --since "$(date +%Y-%m%-d):00:00"
And the following command will process the git repository for statistics:
> gitstats -c commit_begin=<COMMIT_ID> . target/gitstats
And by combining these we can get a simple command we can set as an alias, if we wish:
> first_commit=`git log --pretty=format:"%h" --since "$(date +%Y-%m%-d):00:00" | tail -n1`; gitstats -c commit_begin=$first_commit . target/gitstats
Then open ./target/gitstats/index.html
with your preferred browser
Upvotes: 3
Reputation: 526573
Well, that's going to require a bit of scripting to accomplish, but I'd suggest you start by looking at the output of this command:
git log --format="format:%ae" --numstat
And also note that git log
can also take a --after=<date>
argument.
Upvotes: 2