JetBrains AI Assistant 生成提交消息 (Commit message) 提示语(Prompt) 作者: Chuwen 时间: 2025-02-12 分类: 神奇技巧 评论 ### 2025-02-25 > 基于此进行改造:https://andrewian.dev/blog/ai-git-commits ```text Generate a git commit message following this structure: 1. First line: conventional commit format (type: concise description) (remember to use semantic types like feat, fix, docs, style, refactor, perf, test, chore, etc.) 2. Optional bullet points if more context helps: - Keep the second line blank - Keep them short and direct - Focus on what changed - Always be terse - Don't overly explain - Drop any fluffy or formal language 3. Please provide a response in the following format: (): Return ONLY the commit message - no introduction, no explanation, no quotes around it. Examples: feat(auth): add user auth system - Add JWT tokens for API auth - Handle token refresh for long sessions fix(worker/pool): resolve memory leak in worker pool - Clean up idle connections - Add timeout for stale workers Simple change example: fix: typo in README.md Very important: Do not respond with any of the examples. Your message must be based off the diff that is about to be provided, with a little bit of styling informed by the recent commits you're about to see. And must use Chinese ``` ### 2025-02-12 > 基于此项目进行相关改造:https://github.com/guanguans/ai-commit/blob/main/config/ai-commit.php#L238-L263 ```text IMPORTANT: Your response MUST be in Simplified Chinese (简体中文) only. Additional formatting requirement: - Add a space between Chinese characters and English/numbers/symbols (在中文字符和英文、数字、符号之间添加空格) Here are some best practices for writing commit messages: - Write clear, concise, and descriptive messages that explain the changes made in the commit. - Use the present tense and active voice in the message, for example, "Fix bug" instead of "Fixed bug." - Use the imperative mood, which gives the message a sense of command, e.g. "Add feature" instead of "Added feature" - Limit the subject line to 72 characters or less. - Capitalize the subject line. - Do not end the subject line with a period. - Limit the body of the message to 256 characters or less. - Use a blank line between the subject and the body of the message. - Use the body of the message to provide additional context or explain the reasoning behind the changes. - Avoid using general terms like "update" or "change" in the subject line, be specific about what was updated or changed. - Explain, What was done at a glance in the subject line, and provide additional context in the body of the message. - Why the change was necessary in the body of the message. - The details about what was done in the body of the message. - Any useful details concerning the change in the body of the message. - Use a hyphen (-) for the bullet points in the body of the message. Remember: 1. The commit message must be written in Simplified Chinese (简体中文) 2. Always add a space between Chinese and English/numbers/symbols (在中文和英文、数字、符号之间需要添加空格) Please provide a response in the following format: (): Example: feat(tracking): 添加 TrackingInfoService 数据处理逻辑 feat(login): 添加 OAuth2 认证支持 feat(route): 添加 /test 路由 fix(order): 修复订单可以 0 元购的问题 ```