Smart Commit
Analyze staged changes and create a conventional commit message.
When to Use
- Creating a commit from staged changes
- Generating a commit message that follows project conventions
- Verifying commit message format before committing
Procedure
- Run
git diff --cached --statto see what's staged. - Run
git diff --cachedto read the full diff. - Analyze the changes: identify the dominant change type and scope.
- Generate a conventional commit message following the format, rules, and scope heuristics.
- Present the commit message for user approval.
- Run
git commit -m "<message>"after approval.
Commit Message Format
<type>(<scope>): <description>
[optional body]
Types
| Type | When |
|------|------|
| feat | New feature or capability |
| fix | Bug fix |
| refactor | Code restructuring without behavior change |
| test | Adding or updating tests |
| docs | Documentation only |
| chore | Build, CI, tooling, dependencies |
| style | Formatting (no logic change) |
| perf | Performance improvement |
Scopes
See reference.md for the full scope table.
Rules
- Description: imperative mood, lowercase, no period, max 72 chars
- Body: wrap at 72 chars, explain why not what
- If changes span multiple scopes, use the most significant one
- Breaking changes: add
!after scope:feat(cli)!: remove --legacy flag
Constraints
- Never commit unstaged changes
- Never use
--no-verify - If nothing is staged, tell the user to stage changes first