Also called Truck factor, Lottery factor, Knowledge silo
In depth Code ownership and bus factor from git: the full method, edge cases and what to do about a bus factor of 1.
How bus factor is measured
There is no single standard formula. The most common estimate counts authors in git history:
- For a file, count commits per author over a window of history.
- Sort authors by commit count, highest first.
- Add authors until they cover a set share of all commits (80% is a common cut-off).
- The number of authors you needed is the file's bus factor.
A worked example. billing/invoice.py has 50 commits in the window:
| Author | Commits | Running share |
|---|---|---|
| Priya | 41 | 82% |
| Sam | 6 | 94% |
| Lee | 3 | 100% |
Priya alone covers 82%, which passes 80%, so the file's bus factor is 1. If Priya had 35 commits (70%), you would need Sam as well and the bus factor would be 2.
For a whole project, the academic version is the truck factor algorithm of Avelino et al. (ICPC 2016): it assigns each file to the authors with a "degree of authorship" over it, then removes top authors one at a time until more than half of the files have no remaining author. The number removed is the project's truck factor.
Commit counts are a proxy. Line ownership from git blame is another, and the two can disagree: someone who rewrote a file in one large commit owns its lines but few of its commits.
Why bus factor matters
Bus factor turns "only Priya knows billing" from a hunch into a list you can act on. The files that matter are the ones with bus factor 1 that still change often: each change needs the one person who understands them, reviews stall when they are away, and the knowledge leaves with them. A file with bus factor 1 that nobody has touched in two years is usually fine.
How to measure bus factor yourself
You can get a per-file answer from git alone:
# Commits per author for one file, highest first
git shortlog -sn --no-merges -- billing/invoice.py
# Lines currently owned per author
git blame --line-porcelain billing/invoice.py | grep '^author ' | sort | uniq -c | sort -rnDivide the top author's count by the total to get their share. For a whole repository, the open-source Truck-Factor tool from the Avelino et al. paper computes the project-level figure, and git-fame summarises line ownership per author. Both are free. Neither ranks files by how often they change, so you have to join the result with churn yourself. See the code ownership and bus factor tools roundup for tools that do the join.
How repowise measures bus factor
repowise computes bus factor per file when it indexes git history (up to 5,000 commits by default): the number of top authors needed to cover 80% of the file's commits. It also records the primary owner by git blame line share and the most active recent author.
- Where you see it: the ownership view on the git intelligence page,
get_context(owners per file) andget_riskover MCP, andrepowise context <file>on the CLI. - Fading ownership: a code health detector fires when a still-changing file has bus factor 1 and its primary owner has gone quiet in recent commits. On small teams it stays low severity unless the file is also a hotspot, because bus factor 1 is normal there.
- No model involved: the figure comes straight from
git logandgit blame, so the same history always gives the same number.
For a survey of real projects, see the bus factor of 35 popular open-source repos.