如何在VS Code中给Copilot 的 Generate Commit Message 配自定义提示词
2026-04-29
VS Code 从 1.96 版本开始,支持专门给 Copilot 的 Generate Commit Message 配自定义 instructions,不用再靠 github.copilot.chat.localeOverride 碰运气了。
打开 settings.json
Cmd+Shift+P(Windows 是 Ctrl+Shift+P),或者直接按 F1,搜索 Open User Settings (JSON),回车就进去了。
把下面这段加进去
{
"github.copilot.chat.localeOverride": "zh-CN",
"github.copilot.chat.commitMessageGeneration.instructions": [
{ "text": "始终使用简体中文生成 git commit message。" },
{ "text": "严格按照以下格式输出:<emoji> <type>: <中文简短描述>。" },
{ "text": "只允许使用以下类型和 emoji:✨ feat、🐛 fix、📝 docs、♻️ refactor、⚡ perf、🧑💻 dx、🔨 workflow、🏷️ types、🚧 wip、✅ test、🔨 build、👷 ci、❓ chore、⬆️ deps、🔖 release。" },
{ "text": "根据本次暂存改动的主要目的,选择最合适的一个 type,不要罗列多个。" },
{ "text": "不要输出英文,不要附加解释,不要输出列表,只输出最终的 commit message。" },
{ "text": "描述要简洁、准确、自然,避免"更新代码""调整内容"这类空话。" }
]
}
保存之后,当前用户下打开的所有项目都会默认带上这套规则,点 Generate Commit Message 就能直接生成带 emoji 的中文提交信息了。
参考