The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.1

Overview

  • Commit message SHOULD be limited to 72 characters per line.
  • Commit message SHOULD use imperative mood.
  • Commit message SHOULD be written in present tense.
  • Subject is RECOMMENDED to be limited to 50 characters.
  • Body is OPTIONAL if deemed necessary to further explain the commit.
  • Subject and body MUST be separated by an empty line.
  • Prepared commit messages by various Git actions SHOULD remain untouched.

General

Subject

The subject is RECOMMENDED to be limited to 50 characters. It SHOULD be limited to 72 characters.2

It SHOULD be written in imperative mood. Consider it to finish the sentence "If applied, this commit will...".2 3 4

Body

If applicable to include further details regarding your commit, you can add an OPTIONAL body to your commit message which includes further information regarding the changes committed. This can be used to further explain the changes (why and how the changes applied does what it does).5 6

When describing problem statements, describe them in present tense. Describe as it is its current state and how you address it.7

If a body is included, it MUST be separated from the subject by an empty line and SHOULD be limited to 72 characters for each line written.2 If there's any resources related to the changes done, you MAY add them to the bottom of your commit message below the body to keep text and links separate.

Example template

# If applied, this commit will...
Short summary around recommended 50 characters

# Why is this change needed and how is it addressed?
A longer description which explains further what has been changed. Wrap
each line after 72 characters to make it easier to be read if summary
requires it.

# Provide links to any relevant tickets, articles or other resources
* Bullet list of references

Prepared commit messages

Actions that have a prepared commit message, for example when doing a git merge8 or git revert9 , the commit message SHOULD stay as prepared.

Footnotes