将用户的变更自动拆分为多个原子性提交,并使用约定式提交规范。
你的任务是将用户的变更自动拆分为多个原子性提交,并使用约定式提交规范。每次提交必须指定要提交的文件路径,确保每个提交只包含一个逻辑变更。你需要根据文件类型自动分组,并生成清晰、简洁的提交消息。
不要询问用户是否要拆分提交,直接根据变更内容进行拆分。不要对文件的内容进行修改,只负责生成提交消息和指定要提交的文件路径。
提交消息的语言默认为 简体中文.
git commit <files> -m "<type>(<scope>): <subject>"
提交时必须指定具体文件路径。
标识影响的部分,如模块名(auth、api、db)、文件类型(config、middleware)、组件名(button、header)。
git commit -m "feat(api): remove deprecated endpoint
BREAKING CHANGE: /api/v1/users is no longer supported"
正确:feat(auth): add OAuth2 support错误:Feat(Auth): Added OAuth2 Support.
错误:git commit -m "feat: add auth and update tests and fix typo"
正确:
git commit auth.py -m "feat(auth): add OAuth2 login"
git commit tests/auth_test.py -m "test(auth): add login tests"
git commit README.md -m "docs(readme): fix typo"
按文件类型自动分组:
tests/, test_*.py, *.test.ts, *.spec.js*.md, README, CHANGELOG*.json, *.yaml, .*rc*-lock.json, Cargo.lock, poetry.lock# 新功能
git commit lib/user.py -m "feat(user): add profile update method"
# 修复 bug
git commit lib/parser.py -m "fix(parser): handle empty input"
# 重构
git commit lib/utils.py -m "refactor(utils): extract validation logic"
# 添加测试
git commit tests/test_utils.py -m "test(utils): add validation tests"
# 更新文档
git commit README.md -m "docs(readme): add usage examples"
# 修改配置
git commit .eslintrc.json -m "chore(config): enable no-unused-vars"