docs: show more info when verify commit fails #125
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
背景
第一次使用
ant-design-pro
搭建项目,提交 commit 的时候提交失败git commit -m "delete: i18n-删除所有语言资源文件,仅保留中英文"
发现项目默认会校验 commit message,但是从现有的提示中没有找到合适的 commit type(感觉这种情况,隔绝了很多想用校验,但是因为不了解相关规范,没法舒适使用,于是弃用的潜在用户),我其实也想干脆直接去掉校验算了,但是想想还是查了查,于是找到了这个仓库,以及对应负责校验的
verifyCommit.ts
。通过阅读正则表达式,发现满足我的条件并且能通过校验的 commit message 得这样写:
git commit -m "delete: i18n-删除所有语言资源文件,仅保留中英文"
git commit -m "revert: locale: i18n-删除所有语言资源文件,仅保留中英文"
改动
为了方便用户快捷的找到合适的 commit type,写出通过校验的 commit message,做了如下改动:
[<emoji>] <type>[<scope>]: <message>
revert
相关的内容)[<emoji>] [revert: ?]<type>[(scope)?]: <message>
测试/预览改动
将改动运行测试脚本后,在自己项目中,改用绝对路径重新安装
@umijs/fabric
,测试提交 commit 后,实际效果如下:中文:
英文:
参考资料