Git Commits: Notes Your Future Self Will Understand

Day 18 / Developer Culture

Six months from now, you will open an old project, run git log, and meet your past self. The record they left you: fix, update, final changes 2. Something broke in that code last week, and you have no idea which of those commits introduced it, or why any of them exist.

The commit message is the only documentation that stays attached to every change forever. Code gets refactored, comments get deleted, but the log survives. Writing it well is a small skill with an outsized payoff, and the conventions are older and better settled than most students realise.

The anatomy: subject, blank line, body

Git itself assumes a shape. As the git commit documentation explains, the text up to the first blank line is treated as the commit's title, and that title is reused across Git's tools, from git log --oneline to email patches. A widely followed style guide, Chris Beams' seven rules, builds on that:

  1. Separate the subject from the body with a blank line.
  2. Limit the subject line to 50 characters.
  3. Capitalize the subject line.
  4. Do not end the subject line with a period.
  5. Use the imperative mood in the subject line.
  6. Wrap the body at 72 characters.
  7. Use the body to explain what and why, not how.

The numbers are not arbitrary. Tim Pope's 2008 note that popularised the 50/72 convention points out that Git's own tooling wraps and truncates around them; the Git project's contributing guide in Pro Git still recommends the same shape today.

The anatomy of a commit message: a short imperative subject, a blank line, then a wrapped body explaining what and why.
Concept diagram of the message structure.

Write the subject like an order

Imperative mood feels unnatural at first: "Fix login timeout on slow networks", not "Fixed login timeout" or "Fixes login timeout". The Linux kernel's patch submission guide puts it plainly: describe your changes in imperative mood, as if you are giving orders to the codebase to change its behaviour.

There is a practical reason beyond taste. Git writes its own messages in the imperative when it creates commits for you, such as merges and reverts, so your log reads consistently when you match it. A clean test, from Beams' guide: a properly formed subject completes the sentence "If applied, this commit will your subject here."

The body is for the why

Code shows what changed; the diff already says how. What the next reader cannot recover is the reasoning: what was wrong, why this fix, and what trade-offs you accepted. The Git project itself requires that the body include your motivation for the change and contrast it with the previous behaviour.

The kernel's guide asks for the same discipline in stronger terms: whether your patch is one line or five thousand, there must be an underlying problem that motivated the work, and your description should convince the reviewer the problem is worth fixing. For a student team, the "reviewer" is usually a teammate, or you, three months later, at 2 AM before a demo.

An optional team layer: Conventional Commits

If your group wants machines to read the log too, the Conventional Commits specification adds a small prefix: <type>[optional scope]: <description>. Its mapping to Semantic Versioning is explicit: fix corresponds to a PATCH release, feat to MINOR, and a footer reading BREAKING CHANGE: (or a ! after the type) to MAJOR, whatever the type. That structure is what lets tools generate changelogs and version bumps automatically.

It is a convention, not a law. Many excellent repositories do not use it. What is not optional, in any mature project, is the underlying habit: a clear subject, written as a command, with the reason recorded while you still remember it.

What this looks like in practice

The example below is an invented commit history for illustration; the pattern is real.

An invented before-and-after commit log: vague one-word messages versus short imperative subjects with reasons.
Invented example log, for illustration only.

None of the "after" messages took longer than a minute to write. The difference is that each one answers a question the future reader will actually have.

The takeaway: your commit history is a letter to everyone who touches the code after you, and the most frequent reader is future you. Write the subject as a command, keep it short, and spend one paragraph on the why. Future you will understand, and will be grateful.

Sources and scope

Checked November 18, 2026. Conventions vary by team; if your project publishes its own contributing guide, that guide wins. The example commit log is an invented example for illustration.

Comments

Popular posts from this blog

The code works. Now explain it.

How to verify AI answers: did anyone open the citations?

It works on my laptop. That's the problem.