なぜgitのコミットメッセージは、現在系を使っているのか?

Gitのコミットメッセージでは命令形(imperative mood)を使うのが慣習です。

なぜ「add」(原型)なのか

コミットメッセージの考え方: 「このコミットを適用すると何をするか」を表現するため

テスト方法: 「If applied, this commit will [your commit message]」で文章が成り立つかチェック

正しい例:

  • "If applied, this commit will Add Next.js test job"
  • "If applied, this commit will Fix authentication bug"
  • "If applied, this commit will Update dependencies"

間違った例:

  • "If applied, this commit will Added Next.js test job"
  • "If applied, this commit will Fixed authentication bug"

よく使われる命令形

Add    - 機能や項目を追加
Fix    - バグを修正
Update - 既存のものを更新
Remove - 削除
Rename - 名前変更
Refactor - リファクタリング

実際の例

多くのOSSプロジェクト(Linux、Git、React等)でも同じ慣習が使われています:

Add support for TypeScript
Fix memory leak in parser
Update README with new examples

この慣習に従うことで、世界中の開発者が理解しやすいコミットメッセージになります。

No.2648
09/04 10:08

edit