Git のコミットメッセージの書き方

書き方というよりも、お作法というべきでしょうか。だいたい下記のURLの通りですが備忘録として残しておく。

【翻訳】Gitのコミットメッセージに関する注意点

引用します。

Short (50 chars or less) summary of changes

More detailed explanatory text, if necessary.  Wrap it to about 72
characters or so.  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 can get confused if you run the
two together.

Write your commit message in the present tense: "Fix bug" and not "Fixed
bug."  This convention matches up with 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, preceded by a
  single space, with blank lines in between, but conventions vary here

- Use a hanging indent
変更に対する短い(50文字以下の)要約

もし必要なら、より詳しい説明を述べる。約72文字ほどで折り返すようにせよ。
ある文脈では、最初の行はE-Mailの件名になり、残りのテキストが本文になる。
空行で本文と要約を分離するのは絶対に必要だ(本文を省略していない限り)。
もしも二つを繋げてしまうと、rebaseのようなツールが混乱する可能性がある。

現在時制でコミットメッセージを書くこと。"Fixed bug"ではなく"Fix bug"だ。
この慣習は git merge や git revert のようなコマンドが生成したコミット
メッセージと調和する。

さらなる段落があれば空行の後に続けられる。

- 箇条書きも問題ない

- 箇条書きにはハイフンかアスタリスクが使われ、一つスペースを空けてから
  書き始め、合間には空行が入るのが通常だが、この部分の慣習は多種多様だ

- ぶら下げインデント(一行目だけ飛び出して後はインデントする)を使うこと

ポイントをまとめるとこう。

  • 1行目はコミットの要約を記述。
    • 要約は50文字くらいに収めること。
  • メッセージの詳細は三行目以降に記述。2行目は空行にすること。
  • 時制は現在時制。過去形は使わない。
  • 詳細は箇条書きでも文章でもOK。
  • 72文字で折り返すように記述。

みんな(自分も含む)が読みやすいコミットメッセージを!!!