Writing Commit Messages That Preserve Decisions
A useful commit message identifies the observable change and records important reasoning that a later reader cannot infer from the diff alone.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Tie it to a specific outcome
A message saying an import now keeps the final unterminated row names the behavior. Its body can explain which input exposed the issue. See ordinary bug reproduction for the evidence worth retaining.
Keep one coherent change
If a commit also renames unrelated methods, the summary becomes harder to apply or review later. Selective staging lets authors keep independent decisions separate when their dependencies permit it.[1]
Explain the concrete decision that a diff cannot supply
A change lowers a report's maximum batch size. The diff shows the old and new numbers. A message can record that the downstream consumer accepts at most one hundred records, and describe how the exact boundary was checked. See naming a test by scenario and outcome.
Subject: Keep report batches within the receiver limit
Rationale: receiver rejects batches over 100 records
Verification: tested 99, 100 and 101 records
Preserve enough context for a future reader
Use concrete units and constraints. Mention where an assumption comes from if it may change. An implementation detail can be read in the diff, while tradeoffs and relevant caller behavior need durable explanation.