Analyze staged changes and generate semantic commit messages.
CommandDescription/commitAnalyze staged changes and generate commit/commit -m "message"Commit with custom message/commit --amendAmend previous commit/commit --dry-runPreview commit message without committing
bash
# Verify git repository
git rev-parse --is-inside-work-tree
# Check staged changes
git diff --staged --quiet
# Get staged files
git diff --staged --name-only
If no staged changes: Check git status, prompt user to stage changes first.
bash
git diff --staged
git diff --staged --stat
Analysis Focus:
featrefactor or chorefeat: New feature/functionalityfix: Bug fixrefactor: Code restructuring without behavior changedocs: Documentation onlystyle: Formatting, whitespacetest: Testschore: Build, dependencies, toolingperf: Performance improvementsci: CI/CD changesbuild: Build system changessrc/auth/login.ts → scope: authFormat:
text
<type>(<scope>): <subject>
[optional body]
[optional footer(s)]
Rules:
BREAKING CHANGE:, Closes #123, Fixes #456Examples:
text
feat(auth): add JWT token refresh mechanism
fix(payment): handle duplicate callback correctly
Payment callback was processing duplicates due to missing idempotency
check. Added unique constraint on (order_id, callback_id).
Fixes #234
refactor(db)!: migrate from MySQL to PostgreSQL
BREAKING CHANGE: Database migration required.
bash
# Commit with generated message (author is global git user)
git commit -m "type(scope): subject" [-m "optional body"]
Or use heredoc for multi-line:
bash
git commit -m "$(cat <<'EOF'
type(scope): subject
optional body
EOF
)"
Verify:
bash
git log -1 --oneline
git show HEAD --stat
DO:
DON'T:
bash
git status
# Prompt: "No staged changes. Would you like to stage all changes?"
bash
git rev-parse HEAD 2>/dev/null || git commit -m "chore: initial commit"
bash
git diff --staged --stat
git diff --staged --unified=1
# Suggest splitting into multiple commits
bash
git status | grep "both modified"
git commit -m "merge: resolve conflicts in <files>"
--no-verify only if explicitly requested