What makes a good commit message, and why does Git separate the summary line from the body?

Last updated 6 July 2026

A good commit message concisely states what changed and why in a short summary line, followed by an optional body giving context. Git separates the two by convention (a blank line between them) so tools can treat the first line as a standalone title.

  • Summary line:

    • ~50 characters, imperative mood ("Fix login redirect", not "Fixed"), no trailing period.

    • It should describe the intent, not just the mechanics.

  • Body: Explains the why and the context (trade-offs, background) that the diff can't; wrap around 72 chars.

  • Why the blank-line separation matters:

    • Many tools show only the first line: git log --oneline, git shortlog, GitHub PR titles, and email subjects.

    • Without the blank line, Git can't tell where the title ends, so the whole message collapses into one paragraph.

  • Why it matters overall: History is read far more than it is written: clear messages speed up git blame, git bisect, and code review.

  • https://dangerlanc.com/writing/git-guidelines-for-commit-messages/
  • https://www.freecodecamp.org/news/git-best-practices-commits-and-code-reviews/
  • https://dev.to/noelworden/improving-your-commit-message-with-the-50-72-rule-3g79
  • https://thealphaking.medium.com/how-to-write-a-good-git-commit-message-6e38a717a5a3
  • https://opensource.com/article/22/12/git-commit-message
  • https://medium.com/@mittalyashu/git-commit-messages-472e9a750cbc
  • https://git-scm.com/docs/git-commit
  • https://www.reddit.com/r/git/comments/xllszw/should_commit_messages_include_the_content_of_the/
All Git interview questions