1. 背景
Copilot 中有一个 Generate Commit Message 的功能,该功能可以一键根据当前改动的文件记录,自动创建提交信息摘要(标题)和描述,早期只支持生成英文的。
最近发现最新版支持设置 git-commit-instructions 规则了,该规则可指定生成的语言和规范。
2. 未指定规则前的效果
2.1 未指定前,会发现有 2 个问题
- 生成的是英文的
- 生成的提交信息没有按照业内的 Commit message 通用规范生成

3. 指定规则后的效果
3.1 下面是 git-commit-instructions 提示语
please generate a commit message with Chinese. 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 and must have blank line in message template. Below is the commit message template: <type>(<scope>): <subject> // blank line <body> // blank line <footer> The Header is mandatory, while the Body and Footer are optional. 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 The body section is a detailed description of this commit and can be split into multiple lines. Here's an example: More detailed explanatory text, if necessary. Wrap it to about 72 characters or so. Further paragraphs come after blank lines. - Bullet points are okay, too - Use a hanging indent





