如何规范Git提交注释
- Git提交注释的构成
- Git提交注释的7个好规则
-
- Separate subject from body with a blank line / 使用空行分割主题与内容
- Limit the subject line to 50 characters / 主题行限制为50个字符
- Capitalize the subject line / 主题行首字母大写
- Do not end the subject line with a period/ 主题行行尾不添加句号
- Use the imperative mood in the subject line / 在主题行中使用祈使语气
- Wrap the body at 72 characters / 内容体的每行最大长度不超过72个字符
- Use the body to explain what and why vs. how / 使用内容来详细说明修改了什么以及为什么要修改而不是如何修改
- 完整例子
Git提交注释的构成
主题行
提交/修改内容的简要说明
内容
提交内容的详细说明
参照链接
提及内容关联的需求Id,缺陷Id或Pull Request Id等
Git提交注释的7个好规则
以下是Git提交注释需要遵循的7个好规则
Separate subject from body with a blank line / 使用空行分割主题与内容
Limit the subject line to 50 characters / 主题行限制为50个字符
Capitalize the subject line / 主题行首字母大写
Do not end the subject line with a period/ 主题行行尾不添加句号
Use the imperative mood in the subject line / 在主题行中使用祈使语气
主题行的简单验证规则。格式正确的Git 提交注释的主题行应始终能够完成以下句子:
- If applied,