This script is written in ruby and should make use of your system ruby.
Install this file into a folder in your path (e.g. /usr/bin), then it will be available as a git command:
git cycle-time
This will produce a table output of the last 20 merge commits into the current branch, with stats on the age in days of how long commits took to be merged.
:> git cycle-time
+---------+------------+---------+--------+--------+--------+--------+
| sha | date | changes | oldest | mean | mode | median | (days)
+---------+------------+---------+--------+--------+--------+--------+
| 76b3911 | 2014-07-03 | 6 | 70.00 | 30.00 | 0.00 | 28.00 |
| 1a123ea | 2014-05-22 | 2 | 3.00 | 1.00 | 0.00 | 1.00 |
| c8a01d8 | 2014-04-23 | 8 | 9.00 | 3.00 | 1.00 | 1.00 |
| 73503c1 | 2014-03-03 | 7 | 2.00 | 1.00 | 2.00 | 2.00 |
| e2ad565 | 2014-02-25 | 1 | 1.00 | 1.00 | 1.00 | 1.00 |
| 78db77d | 2014-02-06 | 2 | 10.00 | 5.00 | 0.00 | 5.00 |
| c667220 | 2013-12-19 | 2 | 9.00 | 4.00 | 0.00 | 4.00 |
| ff81642 | 2013-12-11 | 1 | 0.00 | 0.00 | 0.00 | 0.00 |
| 384b1c6 | 2013-12-06 | 4 | 5.00 | 5.00 | 5.00 | 5.00 |
| 4435a53 | 2013-11-30 | 2 | 1.00 | 1.00 | 1.00 | 1.00 |
| a39c492 | 2013-11-30 | 2 | 4.00 | 4.00 | 4.00 | 4.00 |
| aa9b3be | 2013-11-30 | 6 | 46.00 | 25.00 | 29.00 | 25.00 |
| 72a1715 | 2013-10-13 | 8 | 7.00 | 6.00 | 7.00 | 7.00 |
| 340f66f | 2013-10-06 | 20 | 100.00 | 57.00 | 0.00 | 60.00 |
| c5290d3 | 2013-09-30 | 13 | 76.00 | 15.00 | 4.00 | 4.00 |
| 50a6235 | 2013-09-26 | 2 | 0.00 | 0.00 | 0.00 | 0.00 |
| 2b118c2 | 2013-09-24 | 1 | 21.00 | 21.00 | 21.00 | 21.00 |
| d205dfb | 2013-08-19 | 25 | 104.00 | 60.00 | 42.00 | 42.00 |
| 8991d0f | 2013-05-07 | 3 | 107.00 | 36.00 | 0.00 | 1.00 |
+---------+------------+---------+--------+--------+--------+--------+
This is useful in measuring how long it takes code to reach your mainline or release branch.