| 语法 | <type>(<scope>): <描述> |
|---|---|
| 取值建议 | 与模块名/包名/目录名保持一致 |
| 省略 | 全局性改动可省略 scope |
常用示例
常用示例
git commit -m 'fix(auth): 修正 token 过期判断'
git commit -m 'feat(web): 增加暗色主题切换'
# 按范围检索提交
git log --oneline --grep '^(feat|fix)(\(auth\))'scope 不必细到文件级,粒度以「能定位责任模块」为准;全仓级改动直接省略。
scope 用括号标注影响范围(模块、包、目录),面向单仓多模块项目尤其有用;范围名建议与目录/包名一致,便于按范围筛选提交。
| 语法 | <type>(<scope>): <描述> |
|---|---|
| 取值建议 | 与模块名/包名/目录名保持一致 |
| 省略 | 全局性改动可省略 scope |
git commit -m 'fix(auth): 修正 token 过期判断'
git commit -m 'feat(web): 增加暗色主题切换'
# 按范围检索提交
git log --oneline --grep '^(feat|fix)(\(auth\))'