I would like to easily query git to answer a question like the following:

How much time passed from when a developer made a git commit to when that commit was merged to a default branch from a feature branch (if that pattern is being used) or was tagged with a particular tag (for trunk-based development)?

At a higher level, my goal is to see how much time it takes for code to leave a developer's fingers to actually reach production.



1 Answer 1


git-time-metric is a set of tools that allow to track time on Git.

The latest release can be installed automatically using brew or manually by installing the executables listed here.

gtm must first be initialized (gtm init) from with the git project directory to allow time tracking. When you commit your work, gtm then saves the time associated with your commit.

The time can be displayed using the gtm report command; format argument timeline-hours allows to create a Gantt chart.

On a side note, I am not sure whether gtm can help with existing projects. I tried running it onto one of my repos and it logged 0s for all my previous commits.

  • Thank you for this. Can I see an example query that would return the data I seek in the question? :) Preferably with an option to format the output in a machine-oriented format, like JSON, so I can make nice pretty graphs. ;) Commented Oct 20, 2022 at 21:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.