Branch Time

Summary

Branch time is the length of time that a commit lives on a branch, before being merged to the mainline branch.

It is the time between the oldest commit on a branch, after a shared ancestor, and the time a PR is merged to the mainline branch.

Background Information

Calculating Branch Time

There are a number of factors that affect how branch time may be calculated:

  • The branching strategy used, e.g. GitFlow vs Trunk Based Development, may mean a commit has to make it through multiple intermediate branches before reaching master. True Trunk Based Development has a branch time of 0.
  • Granularity of measurement - A unit of work is delivered in one or more change sets (PR). Each PR consists of multiple individual commits.
  • Rewriting history - git has a number of tools that support re-writing the commit log, including rebase, cherry-pick, merge. Each has it’s own effect on the commit log and therefore the calculation of lead times.
  • Abandoned branches do not make it to production but may influence lead time:
    • Failed experiments / discovery prototypes that form part of the “fuzzy front end”

WayFinder calculates branch time based on change sets into your main branch. Every merge to master (or main) is a single change set that triggers your deployment pipeline.

Due to the way that we calculate release time, this leads to some double accounting:

Branch Time Description Image
Branch Time Description

In the example above, when the pipeline fails, the time required to rework is counted twice. The branch time for the rework itself and the release time for the failed change.

WayFinder calculates branch time using the most pessimistic measure. In our opinion this incentivises desirable behaviours that reduce lead time overall.

References

https://blog.carbonfive.com/2017/08/28/always-squash-and-rebase-your-git-commits/

https://www.atlassian.com/git/tutorials/merging-vs-rebasing#the-golden-rule-of-rebasing

https://www.atlassian.com/git/tutorials/using-branches/git-merge

https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History

https://medium.com/thg-tech-blog/measuring-software-delivery-d3e3e078539d