让 Cursor AI 帮忙写 git commit message
不是不想写 commit message,而是每次审阅代码+组织语言去准确描述比较难,耗费精力和时间。
让 Cursor AI 来辅助撰写,提高效率,也学习如何用 Commits 规范和英文去总结和表达。
打开 Composer 或 Chat 窗口, @Commit (Diff of Working State)
,
输入提示词:
write a commit message for changed code with English.
回车提交。
Claude-3.5-sonet 会遵循 Commits 规范写一份 commit message。
注:若已修改的代码中,有不想让AI审阅并写 commit message 的部分,可以提交到暂存更改区(git add)。
另附:可自定义详细的指引提示词。例如在使用其它模型时,可能需要更详细的规范指导:
Please generate a commit message with English.
Make sure it includes an accurate and informative subject line that
succinctly summarizes the key points of the changes, the response must only have commit message content.
Below is the commit message template:
<type>(<scope>): <subject>
Regardless of which part, no line should exceed 72 characters (or 100 characters). This is to avoid automatic Line breaks affecting aesthetics.
Below is the type Enum:
- feat: new feature
- fix: bug fix
- docs: documentation
- style: formatting (changes that do not affect code execution)
- refactor: refactoring (code changes that are neither new features nor bug fixes)
- test: adding tests
- chore: changes to the build process or auxiliary tools