Reading Line Attribution as History Evidence

Line attribution can show which recorded change last touched a line in a selected history. It supplies a starting point for understanding a decision.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Follow a formatting change
  2. Seek the rationale separately
  3. Use line attribution as a pointer to a change
  4. Keep attribution separate from intent or responsibility

Follow a formatting change

A reindentation can touch many lines without changing their behavior. Inspect the attributed commit and adjacent older changes before assuming it introduced the rule. Path-limited history supplies another view.

Seek the rationale separately

A changed number may have its domain explanation in a review or earlier test. Use the difference and its context to find nearby behavior, rather than treating attribution as a conclusion about why it exists.[1]

Use line attribution as a pointer to a change

An attribution view can identify which revision last touched a validation line. That revision might be a project-wide formatting edit. Read its diff and earlier history to find the semantic change and its surrounding tests. See Git history by path.

Current line attributed to formatting commit F
Diff of F changes whitespace
Earlier commit V introduces the validation condition
Review V for why the condition exists

Keep attribution separate from intent or responsibility

Code can move between files, be copied or be rewritten during refactoring. Attribution identifies when a revision introduced or moved text. Verify what the referenced revision actually changed.

References

  1. Scott Chacon and Ben Straub, Pro Git ↩