Also called Co-change, Change coupling, Logical coupling, Hidden coupling
In depth Hidden coupling: find files that change together: the git commands, noise filters and thresholds in full.
How temporal coupling is measured
The method counts shared commits, like association-rule mining. Two numbers matter:
- Support: the number of commits that changed both files.
- Confidence: support divided by the commits that touched one file. It is directional.
A worked example. routes/orders.py appears in 20 commits, schemas/order.json in 10, and 8 commits contain both:
| Measure | Value |
|---|---|
| Support | 8 |
| Confidence (orders.py to order.json) | 8 / 20 = 40% |
| Confidence (order.json to orders.py) | 8 / 10 = 80% |
Eight in ten schema changes also touched the route, so someone editing the schema alone is probably missing a change. If neither file imports the other, the coupling is hidden. Wide commits (mass renames, formatting sweeps) are excluded because they pair unrelated files.
Why temporal coupling matters
Import graphs show structural dependencies. Temporal coupling shows the ones that are not in the code: a schema mirrored in a client, a config parser and the file that documents its keys, a migration and its model. When one half of a pair changes alone, the bug appears later and elsewhere. Gall, Hajek and Jazayeri introduced "logical coupling" for this in "Detection of Logical Coupling Based on Product Release History" (ICSM 1998), and Zimmermann and colleagues used the same idea to recommend further changes in "Mining Version Histories to Guide Software Changes" (ICSE 2004).
How to measure temporal coupling yourself
# Paths changed alongside a given file, over its last 500 commits
git log -n 500 --no-merges --name-only --pretty=format: -- routes/orders.py \
| grep . | sort | uniq -c | sort -rn | head -20The count next to each path is its support with routes/orders.py. Divide by the commits touching the file for confidence. For a whole repository, write a short script that pairs files per commit, skips commits above a size cap and applies a minimum support. CodeScene reports temporal coupling in a UI. The linked guide has a complete script, and the co-change tools roundup compares the tools that compute it.
How repowise measures temporal coupling
repowise computes co-change pairs while indexing git history:
- Window: the same history window as file indexing, the last 5,000 commits by default (never fewer than 2,000). Commits touching more than 200 files are skipped for pairing, and a separate count of focused commits uses a 30-file cap.
- Support: a pair must share at least 2 commits to be stored. Each file keeps its 25 strongest partners. Pair weight decays with commit age (a 500-commit time constant), and
support / commitsgives a directional confidence. - Hidden coupling detector: it fires when both files have at least 5 commits, the shared commits are at least half of the smaller file's commits, and the import graph does not explain the pair. Severity stays at medium below 8 shared commits.
- Missing partners:
repowise riskand theget_riskMCP tool list co-change partners of the changed files that are absent from the diff. - Workspaces: across repositories, co-change is mined from work sessions of 24 hours. A pair needs at least 2 shared sessions and a strength of 0.2.
All of it comes from git with no model involved. See git intelligence and change risk.