← 返回
开发者工具 中文

Git Smart Commit

Analyze staged git changes and generate high-quality commit messages following Conventional Commits format. Use when: (1) user asks to commit changes, (2) us...
分析 Git 暂存区的更改,并遵循约定式提交规范生成高质量的提交信息。
wusuiling-if
开发者工具 clawhub v1.0.0 1 版本 99830.8 Key: 无需
★ 1
Stars
📥 570
下载
💾 2
安装
1
版本
#latest

概述

Smart Commit

Generate precise, conventional commit messages from staged git changes and optionally commit in one step.

Workflow

  1. Run git diff --cached --stat to see what's staged. If nothing is staged, check git diff --stat and ask the user if they want to stage all changes first.
  2. Run git diff --cached to get the full diff (if very large, use --stat summary + sample key hunks).
  3. Analyze the diff and generate a commit message following the rules below.
  4. Present the message to the user. If approved, run git commit -m "".

Commit Message Format

Follow Conventional Commits:

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

[optional body]

[optional footer]

Rules

  • type: One of feat, fix, refactor, docs, chore, test, style, perf, ci, build
  • scope: Optional. Infer from changed files (e.g., auth, api, ui, db). Omit if changes span too many areas.
  • subject: Imperative mood, lowercase, no period, max 72 chars. Be specific — not "update files" but "add retry logic to HTTP client".
  • body: Add only when the "why" isn't obvious from the subject. Wrap at 72 chars.
  • breaking changes: Add ! after type/scope and BREAKING CHANGE: footer.
  • Multiple logical changes: If the diff contains clearly unrelated changes, suggest splitting into multiple commits with git add -p.

Type Selection Guide

SignalType
--------------
New feature, new endpoint, new UI elementfeat
Bug fix, error correction, patchfix
Code restructure, no behavior changerefactor
Comments, README, docs, JSDocdocs
Dependencies, configs, toolingchore
Test files added/modifiedtest
Formatting, whitespace, lintingstyle
Performance improvementperf
CI/CD pipeline changesci
Build system, compilationbuild

Quality Checklist

Before presenting the message, verify:

  • [ ] Subject is specific and descriptive (someone reading git log --oneline can understand the change)
  • [ ] Type accurately reflects the change
  • [ ] Scope is correct or intentionally omitted
  • [ ] No vague words: "update", "change", "modify", "fix stuff", "misc"
  • [ ] Breaking changes are flagged if applicable

Examples

Single file fix:

fix(auth): handle expired JWT tokens in refresh flow

Multi-file feature:

feat(api): add pagination support to list endpoints

Implement cursor-based pagination for /users, /posts, and /comments.
Default page size is 20, max 100.

Breaking change:

feat(config)!: migrate from YAML to TOML configuration

BREAKING CHANGE: config.yaml is no longer supported.
Run `migrate-config` to convert existing configs.

Chore:

chore(deps): bump express from 4.18.2 to 4.19.0

Large Diffs

For diffs exceeding ~4000 lines:

  1. Use git diff --cached --stat for overview
  2. Read key files with git diff --cached --
  3. Summarize the overall change from the stat + sampled hunks
  4. If changes are too diverse, recommend splitting the commit

Options

The user may specify preferences:

  • --no-body: Skip the body, subject only
  • --scope : Force a specific scope
  • --type : Force a specific type
  • --amend: Amend the previous commit instead
  • --dry-run: Generate message without committing

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 22:05 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 672 📥 324,405
productivity

macOS Disk Cleaner

wusuiling-if
分析并回收 macOS 磁盘空间,提供智能清理建议。当用户报告磁盘空间问题或需要清理时使用。
★ 0 📥 538
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,372