A reviewer opens your pull request and reads the commit messages before touching the diff. Those few lines decide whether the review takes ten minutes or an hour, because they tell the reviewer what changed, why it changed, and what to look at first. Learning to write commit messages well is one of the cheapest ways to speed up code review, and it costs nothing but a minute of thought per commit.
How to write commit messages reviewers actually read
Start with the reviewer’s job. They have a queue of changes to check, limited context about your work, and no idea which files matter most. A good message answers three questions in order: what changed, why it changed, and what the reviewer should pay attention to. If the message answers those three, the reviewer can open the diff with a clear picture instead of guessing.
Short messages fail because they skip the second question. “Fix bug” tells the reviewer nothing they cannot see from the diff. “Fix null pointer when the cart is empty” is better, but it still leaves out why the cart can be empty and whether the fix is safe. One extra sentence closes that gap, and that sentence is usually the difference between a quick approval and three rounds of questions.
What a good commit message looks like
Most teams settle on the same shape: a short subject line, a blank line, then a body of a few sentences. The subject states the change. The body explains the reason, the trade-offs, and anything the reviewer should double-check. Keep the subject under 50 characters when you can, and wrap the body at about 72 characters per line so it reads well in a terminal. This commit message format works for solo projects and large teams alike, because it gives every reader the same structure to scan.
Fix crash when the cart is empty
The checkout page assumed at least one item in the cart.
When a user removed the last item and hit refresh, the
page read a property of null and crashed.
This change guards the render path and adds a test for
an empty cart. The payment flow is untouched.
The subject names the fix. The body explains the trigger, the cause, and the scope. A reviewer reading this knows the change is safe to skim and knows exactly which test to check. If your team already follows a fixed format, conventional commits give you a shared vocabulary for the subject line, with types like fix, feat, and docs doing the sorting for you.
Write a subject line that states the change
Write the subject in the imperative mood, as a command to the codebase: “Add login retry” instead of “Added login retry” or “Adds login retry”. The imperative reads like an instruction, and it matches the style Git itself uses in messages like “Merge branch”. It also forces you to name an action, which keeps vague subjects out.
Put the area first when the change touches one part of the system. “auth: Add login retry after token expiry” tells the reviewer where to look before they open a single file. A subject that starts with the area and the action works as a label for the whole commit, and it makes the history searchable months later when someone runs git log to find when a feature landed.
| Weak subject | Strong subject |
|---|---|
| Fix stuff | Fix crash when the cart is empty |
| WIP | Add retry after token expiry |
| Update code | Remove unused payment webhook |
| Changes | auth: Require re-login after password reset |
Notice what the strong subjects share: a verb, a concrete object, and enough context to stand alone. A subject that only makes sense next to the diff has failed its job. If you cannot write a clear subject, that is often a sign the commit itself is doing too much, and splitting it will help both the message and the review.
Use the body to explain why, not what
The diff already shows what changed. Repeating it in the body wastes the reviewer’s time. The body exists for the things the diff cannot show: the reason for the change, the options you ruled out, and the risks that remain. When you pick one approach over another, write down why in a sentence or two. The next person to touch that code, which might be you in six months, will need that reason more than the code itself.
Say what you left out, too. If you skipped a test, note it and say why. If a migration runs slowly on large tables, warn the reviewer so they can check the rollout plan. If a change looks risky but is safe for a specific reason, spell out that reason. Reviewers slow down when they sense hidden risk, and a sentence that names the risk and answers it lets them move on with confidence. These git commit best practices sound simple, but they are the habits that separate a history people trust from one people ignore.
Mistakes that slow review down
Most slow reviews trace back to a handful of habits. Watch for these in your own history:
- Vague subjects. “Fix bug” and “Update” force the reviewer to read every file to learn what happened.
- One commit, several changes. A bug fix bundled with a refactor cannot be approved in part, so the reviewer has to hold both in mind at once.
- Work-in-progress commits. “WIP” and “temp” in a pull request tell the reviewer the author is not sure the change is finished.
- Ticket numbers with no words. “JIRA-1234” alone means the reviewer must open the tracker to learn anything.
- No note on risky changes. A change to auth, payments, or migrations with no explanation gets the slowest, most careful review of all.
One commit should hold one logical change. When a commit mixes a bug fix with a refactor, split them before opening the pull request. If your history is already tangled, learning how rebase reshapes commits helps you clean it up, so each commit tells one story and the reviewer can check them in order.
A template you can copy
When you are unsure what to write, fill in this shape. It fits most changes, and it keeps you from skipping the part that matters most: the reason.
<area>: <imperative subject under 50 characters>
<Why this change was needed, in 2-3 sentences.>
<What the reviewer should check, and what was left out.>
Use all three parts for any change that touches logic, data, or user-facing behavior. For a one-line typo fix, the subject alone is enough. The test is simple: if a teammate read only the message, could they explain the change to someone else? If yes, the message did its job.
Commit messages and AI-assisted review
AI review tools read commit messages the same way a human reviewer does: as the first summary of what a change is for. A clear message helps the tool focus on the right files and flag real problems instead of guessing at intent. A vague message does the opposite, and the tool wastes its comments on questions the message should have answered. Good messages make code review faster for people and machines alike, because both start from the same summary. If your team already runs AI checks on pull requests, the code review checklist for AI-assisted pull requests pairs well with the habits in this guide.
The commit message is not the whole story, though. The pull request description carries the wider context: the problem, the approach, and the testing done. A strong message plus a clear description means the reviewer rarely has to ask for more. If your descriptions are thin, read our guide on how to write a pull request description that gets reviewed faster and treat the two as one workflow.
Pick one habit this week: write the subject line last, after you know what the commit really does. A subject written last describes the change that actually landed, not the one you planned to make. Do that for a month and your history becomes a log your team can search, trust, and review in half the time.