发布于 2026-01-06 3 阅读
0

编写更佳提交信息的几个技巧

编写更佳提交信息的几个技巧

几分钟前,我在阅读 Vue.js 3 的源代码时,发现了一个 Evan You 使用的提交信息模板。我觉得很有意思。如果你喜欢的话,可以看看并尝试将其应用到你的工作流程中。

提交信息前要添加的前缀:

test: (working on tests)
refactor: (refactoring the code)
fix: (doing some bug fixes
feature: (adding the new feature) 
build: ( adding some package or something required when building)
types: (adding the variable type, interface or something like that)
style: (some CSS or style improvement that does not affect the core functionality)
docs: (wrote some documentation or code comments)
wip: (full form: work in progress, when something is under work in progress usually some complex stuff that has to be done in parts)

Enter fullscreen mode Exit fullscreen mode

提交信息示例:

fix: fixed title not defined on the jobs page

Enter fullscreen mode Exit fullscreen mode

改进

我从Angular贡献指南中学到的另一个想法是,我们可以进一步改进提交信息,使其包含更改区域的内容。

在提交前缀之后,您可以像下面fix这样refactor在方括号中包含模块或功能。

fix(auth): fixed the refresh token issue

refactor(registration): Improve the performance by putting email sending logic in queue
Enter fullscreen mode Exit fullscreen mode

感谢阅读。

文章来源:https://dev.to/bawa_geek/few-tips-for-writing-better-commit-messages-2ie6