鱼皮AI导航
鱼皮AI导航
  • 主页
  • 社区
  • AI工具
  • AI知识库
  • AI提示词
  • MCP
  • Skills
  • AI学习资源
  • AI资讯
  • GitHub开源
登录/注册

commit-message

基于 staged 变更自动分析代码差异,生成符合规范的多语言提交信息,支持自定义模板、Jira 集成、文件过滤及历史提交修正,兼顾语义准确性与团队协作格式要求。

测试与安全效率工具开发运维
访问 GitHub
文档Skills.MD
name
commit-message
description
Automatically generates, formats, organizes, and improves git commit messages by analyzing your staged changes using AI. Use this skill when you want to create, write, review, or refine commit messages - whether you need to save time, maintain consistent formatting, or better describe your code changes.

Generating Commit Messages

Step-by-Step Instructions

Installation

  1. Run the install script to download and set up CodeGPT:

    ▼
    bash
    复制代码
    bash < <(curl -sSL https://raw.githubusercontent.com/appleboy/CodeGPT/main/install.sh)
  2. Configure your AI provider in ~/.config/codegpt/.codegpt.yaml:

    ▼
    yaml
    复制代码
    openai: provider: openai # or: azure, anthropic, gemini, ollama, groq, openrouter api_key: your_api_key_here model: gpt-4o

Basic Usage

  1. Stage your changes:

    ▼
    bash
    复制代码
    git add <files>
  2. Generate and commit with AI-generated message:

    ▼
    bash
    复制代码
    codegpt commit --no_confirm

    Note:

    • Commit messages are generated in English by default. Use --lang to specify a different language.
    • You don't need to manually run git diff to review your changes. CodeGPT automatically reads the staged changes and analyzes them to generate an appropriate commit message.

Advanced Options

  • Set language: Use --lang to specify output language (default: en)

    ▼
    bash
    复制代码
    codegpt commit --lang zh-tw --no_confirm # For Traditional Chinese codegpt commit --lang zh-cn --no_confirm # For Simplified Chinese

    To change the default language permanently:

    ▼
    bash
    复制代码
    codegpt config set output.lang en # or zh-tw, zh-cn
  • Use specific model: Override the default model

    ▼
    bash
    复制代码
    codegpt commit --model gpt-4o --no_confirm
  • Exclude files: Ignore certain files from the diff analysis

    ▼
    bash
    复制代码
    codegpt commit --exclude_list "*.lock,*.json" --no_confirm
  • Custom templates: Format messages according to your team's style, including Jira issue tracking

    ▼
    bash
    复制代码
    # Basic custom format codegpt commit --template_string "[{{.summarize_prefix}}] {{.summarize_title}}" --no_confirm # With Jira issue number using template variables codegpt commit --template_vars "JIRA_NUM=GAIA-2704" \ --template_string "{{.summarize_prefix}}{{if .JIRA_NUM}}({{.JIRA_NUM}}){{end}}: {{.summarize_title}}\n\n{{.summarize_message}}" \ --no_confirm

    Available built-in template variables:

    • {{.summarize_prefix}} - Conventional commit type (feat, fix, docs, etc.)
    • {{.summarize_title}} - The commit title
    • {{.summarize_message}} - The full commit message body

    You can define custom variables with --template_vars "KEY=VALUE" and use them as {{.KEY}}

  • Amend commit: Update the previous commit message

    ▼
    bash
    复制代码
    codegpt commit --amend --no_confirm

Examples of Inputs and Outputs

Example 1: Adding a new feature

Input:

▼
bash
复制代码
# After making changes to add user authentication git add src/auth.go src/middleware.go codegpt commit --no_confirm

Output:

▼
txt
复制代码
feat: add user authentication middleware Implement JWT-based authentication system with login and token validation middleware for protecting API endpoints.

Example 2: Fixing a bug

Input:

▼
bash
复制代码
# After fixing a null pointer error git add src/handlers/user.go codegpt commit --no_confirm

Output:

▼
txt
复制代码
fix: resolve null pointer exception in user handler Add nil checks before accessing user object properties to prevent crashes when processing requests with missing user data. [Preview shown, waiting for confirmation...]

Example 3: Chinese language commit

Input:

▼
bash
复制代码
git add docs/README.md codegpt commit --lang zh-tw --no_confirm

Output:

▼
txt
复制代码
docs: 更新專案說明文件 新增安裝步驟說明以及使用範例,讓新使用者能夠快速上手。

Example 4: Jira issue tracking integration

Input:

▼
bash
复制代码
# Stage your changes git add Dockerfile docker-compose.yml # Generate commit with Jira issue number using template variables codegpt commit --template_vars "JIRA_NUM=GAIA-2704" \ --template_string "{{.summarize_prefix}}{{if .JIRA_NUM}}({{.JIRA_NUM}}){{end}}: {{.summarize_title}} {{.summarize_message}}" \ --no_confirm

Output:

▼
txt
复制代码
feat(GAIA-2704): update trivy scan for cicd - Add appuser (uid=1000) to run containers as non-root user - Fix trivy scan DS002: Image user should not be 'root' - Create /.app directory with proper ownership for externalimage

Tip: Save the template in config file to avoid typing it every time:

▼
bash
复制代码
# Set the template once codegpt config set git.template_string "{{.summarize_prefix}}{{if .JIRA_NUM}}({{.JIRA_NUM}}){{end}}: {{.summarize_title}} {{.summarize_message}}" # Then just provide the Jira number when committing codegpt commit --template_vars "JIRA_NUM=GAIA-2704" --no_confirm

Example 5: Excluding lock files

Input:

▼
bash
复制代码
git add . codegpt commit --exclude_list "package-lock.json,yarn.lock,go.sum" --no_confirm

Output:

▼
txt
复制代码
refactor: reorganize project structure Move utility functions into separate packages and update import paths throughout the codebase for better modularity. (Lock files excluded from analysis)

Common Edge Cases

No staged changes

Issue: Running codegpt commit without staging any changes.

Solution: Stage your changes first:

▼
bash
复制代码
git add <files> codegpt commit

API timeout for large diffs

Issue: Large changesets may cause API timeouts.

Solution: Increase timeout or commit changes in smaller batches:

▼
bash
复制代码
codegpt commit --timeout 60s --no_confirm

Generated files in diff

Issue: Lock files or generated code affecting commit message quality.

Solution: Exclude these files from analysis:

▼
bash
复制代码
codegpt commit --exclude_list "package-lock.json,yarn.lock,*.min.js,dist/*" --no_confirm

API key not configured

Issue: Error message about missing API key.

Solution: Set up your API key in the config file:

▼
bash
复制代码
codegpt config set openai.api_key "your-api-key-here"

Custom commit format required

Issue: Team requires specific commit message format with Jira issue tracking numbers.

Solution: Use --template_vars with custom templates.

Basic usage:

▼
bash
复制代码
codegpt commit --template_vars "JIRA_NUM=GAIA-2704" \ --template_string "{{.summarize_prefix}}{{if .JIRA_NUM}}({{.JIRA_NUM}}){{end}}: {{.summarize_title}} {{.summarize_message}}" \ --no_confirm # Result: feat(GAIA-2704): update trivy scan for cicd

Save template in config for convenience:

▼
bash
复制代码
# Set the template once codegpt config set git.template_string "{{.summarize_prefix}}{{if .JIRA_NUM}}({{.JIRA_NUM}}){{end}}: {{.summarize_title}} {{.summarize_message}}" # Then just provide the Jira number codegpt commit --template_vars "JIRA_NUM=GAIA-2704" --no_confirm

Or edit ~/.config/codegpt/.codegpt.yaml:

▼
yaml
复制代码
git: template_string: "{{.summarize_prefix}}{{if .JIRA_NUM}}({{.JIRA_NUM}}){{end}}: {{.summarize_title}}\n\n{{.summarize_message}}"

Create a shell function for convenience:

Add to your ~/.bashrc or ~/.zshrc:

▼
bash
复制代码
function commit() { if [ -z "$1" ]; then echo "Usage: commit <JIRA-NUM>" return 1 fi codegpt commit --template_vars "JIRA_NUM=$1" --no_confirm } # Usage: commit GAIA-2704

Auto-extract from git branch name (advanced):

If your branch follows naming convention like feature/GAIA-2704-add-security-scan:

▼
bash
复制代码
# Add to ~/.bashrc or ~/.zshrc function commit-auto() { local branch=$(git rev-parse --abbrev-ref HEAD) local jira_num=$(echo "$branch" | grep -oE '[A-Z]+-[0-9]+' | head -1) if [ -z "$jira_num" ]; then echo "No Jira issue found in branch: $branch" codegpt commit --no_confirm else echo "Detected Jira issue: $jira_num" codegpt commit --template_vars "JIRA_NUM=$jira_num" --no_confirm fi } # Usage: commit-auto (auto-detects GAIA-2704 from branch name)

Network proxy required

Issue: API calls fail due to corporate firewall.

Solution: Configure proxy settings:

▼
bash
复制代码
codegpt commit --proxy http://proxy.company.com:8080 # Or for SOCKS proxy codegpt commit --socks socks5://127.0.0.1:1080
测试与安全
效率工具
开发运维

快捷安装

复制到终端去安装 Skill

npxskillsaddappleboy/CodeGPT--skill"commit-message"
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
🔥热门工具
朱雀AI检测朱雀AI检测
朱雀AI检测助手朱雀AI检测助手
LovartLovart
老鱼简历老鱼简历
WritePass官网WritePass官网
面多多面多多
CursorCursor
星月写作星月写作
朱雀AI检测助手朱雀AI检测助手
零感AI零感AI
Skills 推荐
debug
debug 是一个系统化定位软件缺陷根因的技能,适用于用户报告 'fix'、'broken'、'error' 等问题或测试意外失败时。它通过可验证的假设、最小复现、因果链分析和回归测试,确保在修复前准确定位根本原因。
retrieving-developer-knowledge
retrieving-developer-knowledge 用于搜索、获取和整合 Google 官方开发者文档,覆盖 Google Cloud、AI/Gemini、Android、Chrome、Web、Flutter、Go、Firebase 等平台,适用于查询 gcloud CLI 命令、API 语法、IAM 权限或架构对比等场景。
diff-intake
diff-intake 读取 PR 或分支差异,生成结构化 YAML 变更摘要,用于下游 analytics instrumentation 技能。适用于用户提交 PR 链接、分支对比或原始 diff 后需理解变更内容、评估分析覆盖或启动埋点流程的场景。
load-balancer-configurator
根据用户需求自动生成各类负载均衡器的生产级配置,覆盖 ALB、NLB、Nginx 和 HAProxy 等主流类型,适配不同协议、端口、健康检查及后端服务拓扑,支持直接集成到基础设施即代码流程中。
webapp-testing
提供本地 Web 应用的端到端测试能力,支持页面导航、元素交互、表单填写、动态等待、断言验证、截图捕获、浏览器日志收集及网络请求拦截,适用于前端功能验证与 UI 行为调试。