Commit with Multi-line Body

How to structure a Conventional Commit with a multi-line body. Learn the blank line rule, body line length limits, and when to add detailed explanations.

Best Practices

Detailed Explanation

Adding a Body to Your Commit

The commit body provides additional context that does not fit in the subject line. It explains why the change was made, not just what changed.

Structure

fix(cache): prevent stale data after TTL expiration

The cache was returning stale entries when the TTL expired
during a concurrent read. The fix adds a lock-free check
of the expiration timestamp before returning cached values.

This was causing intermittent 500 errors on the /api/users
endpoint when cache entries expired under high load.

Rules for the Body

  1. Blank line: A blank line is required between the subject and the body. Without it, Git treats the entire message as the subject.
  2. Line length: Body lines should wrap at 100 characters. The linter issues a warning for lines exceeding this limit.
  3. Content: Explain the motivation for the change, the problem it solves, and any trade-offs or alternatives considered.
  4. Formatting: You can use bullet points, numbered lists, and code blocks in the body.

When to Add a Body

Not every commit needs a body. Add one when:

  • The change fixes a non-obvious bug (explain the root cause).
  • The approach is counter-intuitive (explain why this solution was chosen).
  • The change has side effects (document them).
  • The change reverts a previous commit (reference the original).
  • The commit modifies behavior that other developers rely on.

Body vs Pull Request Description

The commit body lives in the Git history permanently. The PR description lives on the hosting platform (GitHub, GitLab). Use the commit body for information that should be accessible to anyone reading the Git log, even without access to the hosting platform.

Line Wrapping

Most terminals display 80-120 characters per line. Wrapping body text at 72-100 characters ensures readability in git log output without horizontal scrolling.

Use Case

Add a multi-line body to commits that fix complex bugs, introduce architectural decisions, or have non-obvious implications. The body provides permanent context in the Git history that helps future developers understand why a change was made.

Try It — Conventional Commits Linter

Open full tool