Skip to content

Writing a commit message

Subject 50 chars, imperative mood, body wrapped at 72, explain why not what, link to the issue, and sign if the project requires it.

A commit message that survives time

  1. Subject: 50 chars, imperative

    "Add retry logic to Stripe webhook" — not "Added" nor "Adding".

  2. Blank line, then body

    The body explains why: the motivation, the previous behaviour, the new behaviour, edge cases.

  3. Wrap at 72 chars

    Email-era convention that still aids git log readability.

  4. Reference issues and PRs

    "Fixes #42" auto-closes the issue when merged.

  5. Sign when required

    git commit -S (GPG) or -s (Developer Certificate of Origin). Do not skip unless the project allows it.