Skip to content
| Marketplace
Sign in
Visual Studio Code>SCM Providers>Git Commit CheckerNew to Visual Studio Code? Get it now.
Git Commit Checker

Git Commit Checker

Maxiaosong

| (0) | Free
?? Git Commit ??????,??????????
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Git Commit Checker

GitHub VSCode TypeScript License: MIT

📦 GitHub 仓库: https://github.com/maxiaosong1124/git-commit-checker

一个 VSCode 插件,用于检查和规范 Git Commit 提交信息格式,确保团队代码提交规范的统一性。

✨ 功能特性

  • 🔍 自动检测代码差异 - 提交前自动获取暂存区的代码变更
  • ✅ Commit 信息格式校验 - 按照 Conventional Commits 规范验证提交信息
  • 🎯 智能提交引导 - 5步交互式界面引导用户填写规范的 commit 信息
  • 🤖 AI 智能生成 - 支持使用 AI 分析代码差异,自动生成规范的提交描述
  • ⚙️ 自定义规则配置 - 支持项目级别的提交格式自定义

📦 安装

  1. 打开 VSCode
  2. 按 Ctrl+P 打开快速命令面板
  3. 输入 ext install git-commit-checker
  4. 点击安装

或者从源码安装:

cd git-commit-checker-extension
npm install
npm run compile

🚀 使用方法

快捷键

快捷键 功能
Ctrl+Shift+G C (Windows/Linux) 开始规范化提交
Cmd+Shift+G C (Mac) 开始规范化提交

命令面板

按 Ctrl+Shift+P 打开命令面板,输入:

  • Git Commit Checker: 提交 - 开始规范化提交流程
  • Git Commit Checker: 查看差异 - 查看暂存区代码差异

提交流程

  1. 选择提交类型 - 从预定义的类型列表中选择(feat、fix、docs 等)
  2. 输入影响范围 - 可选,输入本次修改影响的模块
  3. 输入简短描述 - 用一句话描述本次修改
  4. 添加详细描述 - 可选,添加更详细的说明
  5. 添加关联信息 - 可选,关联 Issue 或标记 Breaking Change

📋 Commit 信息格式

本插件遵循 Conventional Commits 规范:

<type>(<scope>): <subject>

<body>

<footer>

支持的类型

Type 说明 Emoji
feat 新功能 ✨
fix Bug 修复 🐛
docs 文档更新 📚
style 代码格式调整 💄
refactor 代码重构 ♻️
perf 性能优化 ⚡
test 测试相关 ✅
build 构建系统变更 🔧
ci CI 配置变更 👷
chore 其他杂项 🔨
revert 回滚提交 ⏪

示例

feat(auth): 添加用户登录功能

实现了基于 JWT 的用户认证机制,包括:
- 用户名密码登录
- Token 刷新
- 登出功能

Closes [#123](https://github.com/maxiaosong1124/git-commit-checker/issues/123)

⚙️ 配置选项

在 VSCode 设置中搜索 gitCommitChecker 进行配置:

设置项 类型 默认值 说明
types array 见上表 允许的提交类型列表
typeDescriptions object 见上表 类型的中文描述
subjectMaxLength number 50 subject 最大长度
subjectMinLength number 3 subject 最小长度
scopeRequired boolean false scope 是否必填
bodyRequired boolean false body 是否必填

基础配置示例

{
  "gitCommitChecker.types": ["feat", "fix", "docs", "refactor"],
  "gitCommitChecker.subjectMaxLength": 72,
  "gitCommitChecker.scopeRequired": true
}

🤖 AI 功能配置

启用 AI 智能生成功能需要配置以下设置:

设置项 类型 默认值 说明
ai.enabled boolean false 是否启用 AI 功能
ai.apiKey string "" OpenAI 格式 API 的 API Key
ai.endpoint string "https://api.openai.com/v1" API 端点地址
ai.model string "gpt-4o-mini" 使用的模型名称
ai.timeout number 30000 请求超时时间(毫秒)
ai.maxDiffLength number 8000 发送给 AI 的最大 diff 字符数

AI 配置示例

{
  "gitCommitChecker.ai.enabled": true,
  "gitCommitChecker.ai.apiKey": "sk-your-api-key",
  "gitCommitChecker.ai.endpoint": "https://api.openai.com/v1",
  "gitCommitChecker.ai.model": "gpt-4o-mini"
}

💡 提示: 支持自定义端点,可以使用本地 LLM(如 Ollama、vLLM 等)或其他 OpenAI 兼容的 API 服务。

🛠️ 开发

环境要求

  • Node.js >= 18
  • VSCode >= 1.85.0

本地开发

# 安装依赖
npm install

# 编译
npm run compile

# 监听模式
npm run watch

# 打包
npm run package

调试

  1. 在 VSCode 中打开项目
  2. 按 F5 启动调试
  3. 在新打开的 Extension Development Host 窗口中测试插件

📄 许可证

MIT License

🤝 贡献

欢迎参与项目开发!

  • 🐛 提交 Bug 报告
  • 💡 提交功能建议
  • 🔧 提交 Pull Request

贡献步骤

  1. Fork 本仓库
  2. 创建功能分支 (git checkout -b feature/amazing-feature)
  3. 提交更改 (git commit -m 'feat: add amazing feature')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 创建 Pull Request

📚 参考

  • Conventional Commits
  • VSCode Extension API
  • Angular Commit Guidelines
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft