Glossary · Git history

What is temporal coupling?

Temporal coupling, also called co-change, change coupling or logical coupling, is when two files repeatedly change in the same commits even though neither imports the other. It is detected from version history, not from code structure, and shows hidden dependencies that a reviewer cannot see in a diff.

Last reviewed: November 2026

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:

MeasureValue
Support8
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 -20

The 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 / commits gives 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 risk and the get_risk MCP 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.

FREQUENTLY ASKED

Temporal coupling: questions

What is the difference between temporal coupling and logical coupling?

They are the same idea under different names. Logical coupling is the term from the research literature (Gall, Hajek and Jazayeri, ICSM 1998); temporal coupling and change coupling are the names practitioners use.

How do you calculate temporal coupling?

Count the commits in which both files changed (support), then divide by the number of commits that touched each file (confidence). Skip merges and very large commits, which pair unrelated files.

Is temporal coupling bad?

Not always. A test and its source file change together by design. It is a problem when files with no import link change together, because the link is a rule held in people's heads and one side gets forgotten.

Can temporal coupling cross repositories?

Yes, when you group commits from several repos into work sessions. A client and a server in separate repos often change together, and no single repository's history shows it.

See it on your own repository.

Index a repository free and read the result for your own code and history. Rolling it out to a team? We will walk you through it.