Subject: Re: How to generate feature branch statistics?

From: Jakub Narębski <[email-masked]>
Date: Wed, 20 Jul 2016 20:10:54 +0200

W dniu 2016-07-20 o 15:56, Jakub Narębski pisze:
> W dniu 2016-07-20 o 10:05, Ernesto Maserati pisze:
> 
>> I assume that feature branches are not frequently enough merged into
>> master. Because of that we discover bugs later than we could with a more
>> continuous code integration. I don't want to discuss here whether feature
>> branches are good or bad.
>>
>> I want just to ask is there a way how to generate a statistic for the
>> average duration of feature branches until they are merged to the master? I
>> would like to know if it is 1 day, 2 days or lets say 8 or 17 days. Also it
>> would be interesting to see the statistical outliers.
>>
>> I hope my motivation became clear and what kind of git repository data I
>> would like to produce.
>>
>> Any ideas?
> 
> There are at least two tools to generate statistics about git repository,
> namely Gitstat (https://sourceforge.net/projects/gitstat) and GitStats
> (https://github.com/hoxu/gitstats), both generating repo statistics as
> a web page. You can probably find more... but I don't know if any includes
> the statistics you need.
> 
> I assume that you have some way of determining if the merge in 'master'
> branch is a merge of a topic branch, or of long-lived graduation branch
> (e.g. 'maint' or equivalent). To simplify the situation, I assume that
> the only merges in master are merges of topic branches:
> 
>   git rev-list --min-parents=2 master | 

Self correction: Here you need to use --first-parent, as in Peff answer
(which also uses less git invocations, and less of git porcelain).

I wonder if it is something that libgit2 would be helpful...
-- 
Jakub Narębski