Skip to content

Latest commit

 

History

History
82 lines (63 loc) · 4.56 KB

File metadata and controls

82 lines (63 loc) · 4.56 KB

Commit message

The commit message must have the following structure, adapted from Pro Git [1]:

<EMOJI> Capitalized, short (50 characters or fewer) summary
                             -- BLANK LINE --
More detailed explanatory text, if necessary. Word-wrap it to 72 characters
per line. In some contexts, the first line is treated as the subject of an
email and the rest of the text as the body. The blank line separating the
summary from the body is critical (unless you omit the body entirely); tools
like rebase will confuse you if you run the two together.

Write the summary in the imperative mood: "Fix bug," not "Fixed bug" or
"Fixes bug." Use the same imperative style for action-oriented sentences in
the body. This convention matches commit messages generated by commands like
git merge and git revert.

Further paragraphs come after blank lines.

- Bullet points are okay, too.

- Typically a hyphen or asterisk is used for the bullet, followed by a
  single space, with blank lines in between, but conventions vary here.

- Use a hanging indent.

Notice that:

  1. The summary must be 50 characters or fewer. The required emoji must be a short code (for example, :tada:), not the emoji character itself, and each emoji counts as one character toward the limit.
  2. Don't end the summary with a period.
  3. The summary must use the imperative mood for an action. Write "Fix ...", "Change ...", or "Add ...", not "Fixed ...", "Changed ...", or "Added ...". Do not use past-tense or third-person formulations.
  4. Use one emoji per commit unless a warning emoji is required as described below.
  5. Punctuate every complete sentence or phrase in the body. This requirement applies to the body as a whole, not to each physical wrapped line.
  6. If there is a body, a blank line must separate it from the summary.
  7. The body has no overall length limit, but every physical line must be no more than 72 characters.

IMPORTANT: Word-wrap all body text to 72 characters using greedy wrapping: pack as many words as possible onto each line before breaking. Do not break earlier than necessary. Each line should be as close to 72 characters as possible without exceeding it. An unbreakable token longer than 72 characters may exceed the limit; do not split such a token.

WRONG (lines break too early, wasting space):

This refactors the authentication module to
use token-based validation instead of
session cookies, improving scalability.

CORRECT (greedy — each line filled to near 72 chars):

This refactors the authentication module to use token-based validation
instead of session cookies, improving scalability.

To verify: no line should be breakable later (i.e., the next word must not fit on the current line). If a word would fit on the previous line without exceeding 72 characters, it must be placed there, except that an unbreakable token may exceed the limit.

Commit emojis

The required emoji at the start of the summary identifies the kind of change introduced by the commit. The following table lists common change types and their corresponding short codes:

Change type Emoji short code
Initial commit 🎉
Version tag 🔖
New feature
Bug fix 🐛
Refactoring 📦
Documentation 📚
Internationalization 🌐
Performance 🐎
Cosmetic change 💄
General improvement 🔧
Tests 🚨
Deprecation 💩
Work in progress (WIP) 🚧
Warning ⚠️
Other See gitmoji.dev

Note: If the commit contains an important warning, such as a breaking change, add the ⚠️ short code to the summary. In this case, two emojis can be used.

References