I am trying to get (statistical) commit information from a repo. I therefore did:
$ git clone remote/path/to/repo localrepo && cd localrepo
$ git pull
$ git show --since 'Oct-03-2014' --until 'Oct-13-2014' --shortstat
Generally, if there are commits during that period on the origin/master
branch (which I'm currently on), the last line of the above command will produce the nice summary output I want.
The problem is if the time period contains merges from a different branch. For those, git doesn't produce any kind of output (apparently merges don't contain diffs that can be shown).
So how can I get the nice --shortstat
summary that includes information about the merge diffs?
As you have discovered - date/time stamps are not a reliable way to query git history, and one of the ways in which they fail is handling merge commits.
So for this specific instance, manually investigate your tree and find the commit on mainline that you want to start at (corresponding to Oct 3). Call that SHA_OLD
. Now pick a SHA on mainline corresponding to Oct 13. Call that SHA_NEW. Then use
git show ^SHA_OLD SHA_NEW --shortstat
In the future you can make this process easier by using tags. git tag
commits periodically, and then use those as your arguments to git show