はじめに

私たちのコミット規約を学ぼう

2 min read
•264 words

私たちはクリーンなプロジェクト履歴を持つのが好きです。私たちのコミット規約は Conventional Commits に触発されていますが、もっと視覚的で楽しくするために gitmoji でカスタマイズされています。

構造

コミットメッセージは以下のように構造化されていて、小文字で書くべきです:

<gitmoji> <type> <description> [(#<issue number>)]

[任意の本文]

[任意のフッター]

例

📝 update documentation contributors

- Add @jerembdn as a contributor
- Add @younesbessa as a contributor

Co-authored-by: Younes Bessa <[email protected]>

大抵の場合、シンプルなワンライナーで十分です:

📝 update documentation contributors

タイプ

私たちは以下のコミットタイプを使用します:

タイプ説明
add新機能を追加
fixバグを修正
improve何かを改善
update何かを更新
remove何かを削除
refactor何かをリファクタリング
rename何かの名前を変更
moveファイルやフォルダーを移動
upgrade依存関係をアップグレード
downgrade依存関係をダウングレード
initialリポジトリの初期コミット
releaseリリース / バージョンタグ

リポジトリの最初のコミットは initial を使用し、バージョンタグは release を使います:

🎉 initial commit
🔖 release @onruntime/translations v0.3.0

説明

<type> は主語の動詞で、説明がそれを補完します。一緒に読むと、一文になります:

# Good
📝 update documentation contributors

だから、説明を第二の動詞で始めないでください。タイプはすでに一つあり、主語が二つの文を重ねてしまいます。これは fix: プレフィックスがもたらすものです。動詞を省いて、何に作用したのかを残してください:

# Bad
💄 improve scale down the gem on its card
🐛 fix stop the footer from wrapping

# Good
💄 improve the gem size on its card
🐛 fix the footer wrapping

命令形 と 小文字 で書いてください:

# Bad
📝 updated documentation contributors

# Bad
📝 Update documentation contributors

名詞としての動詞

一部の単語は動詞と名詞の両方ですが、あなたが指しているのは名詞です: ✨ add open graph image は大丈夫です。動詞として読むと、冠詞が名詞句に戻ります: ✨ add a show more button。

イシュー番号

コミットをイシューにリンクさせるには、イシュー番号を追加します:

📝 update documentation contributors (#123)

本文

本文はコンテキストと動機のために使用します:

📝 update documentation contributors

- Add @jerembdn as a contributor
- Add @younesbessa as a contributor

Co-authored-by: Younes Bessa <[email protected]>

一つのコミット、一つの目的

各コミットは単一の論理的変更を表すべきです。無関係な変更を混ぜるべきではありません。