让 Cursor AI 帮忙写 git commit message

不是不想写 commit message,而是每次审阅代码+组织语言去准确描述比较难,耗费精力和时间。
让 Cursor AI 来辅助撰写,提高效率,也学习如何用 Commits 规范和英文去总结和表达。

Cursor v0.43 版本已支持直接在 git 面板一键生成 commit message。 (2024-12-03)

2025-06-04 更新:根据实践经验,建议先按照规范提交一条 commit message 之后, Cursor 的自动生成 commit message 功能,会自动学习到你的 commit message 风格,后续会自动生成符合你风格的 commit message。

自定义提示词:

Please write a Git commit message following the Angular Commit Message Convention.
Your message should be clear, concise, and in **English**.

## Format:
'''
<type>(<scope>): <subject>

<body>

<footer>
'''

* `<type>`: required. Choose one of the following:

  * `feat`: a new feature
  * `fix`: a bug fix
  * `docs`: documentation only changes
  * `style`: code style/formatting (no logic changes)
  * `refactor`: code changes that neither fix a bug nor add a feature
  * `test`: adding or updating tests
  * `chore`: tooling, build, or auxiliary changes
  * `perf`: performance improvements

* `<scope>`: optional. A single word describing the impacted module or area.

* `<subject>`: required. A short summary of the change (max 72 characters).

## Body (Optional):

* Explain what and why (not how).
* Use bullet points or short paragraphs.
* Each line should ideally be ≤ 72 characters to maintain readability.

## Footer (Optional):

* Link to issues using `Closes #123`, etc.
* Note breaking changes using `BREAKING CHANGE:`.

## Example:

'''
feat(auth): add support for WeChat login

- Enable WeChat QR code login
- Support account binding for WeChat users
- Sync basic WeChat user info to user profile

Closes #123
'''
"""

打开 Chat 窗口,选择 Ask 或 Manual 模式,

在提示词输入框输入 @Commit (Diff of Working State)

并输入上述提示词,回车提交。

Cursor 会遵循 Commits 规范写一份 commit message。

注意:Cursor 审查的是工作区的代码,而不是暂存区的代码。所以如果不想让 Cursor 审阅的代码,可以先提交到暂存区(git add)。