Create Commit
Follow the source workflow in references/commit-command.md.
Workflow
- Inspect staged changes first.
git diff --staged --stat
- If nothing is staged, inspect unstaged changes.
git diff --stat
- If unstaged changes exist, ask whether to:
- Stage all changes and commit.
- Stage specific files and commit.
- Stop for manual staging.
- For option 1, run
git add -A. - For option 2, run
git add <paths>.
- Analyze actual staged content before writing the message.
git diff --staged --name-only
git diff --staged <file>
- Match repository commit style.
git log -5 --oneline
- Draft a concise but informative message from the actual change intent.
- Prefer Conventional Commit style when the repo uses it.
- Keep header under 72 characters (target 50-72).
- Make the header specific: what changed and why/impact in one line.
- Use imperative mood.
- If context is non-trivial, add a short body (1-3 lines) with key details.
-
If user provides
-m "<message>", use it exactly. -
Execute commit.
# Subject only (default)
git commit -m "<generated-subject>"
# Add body only when needed
git commit -m "<generated-subject>" -m "<short body>"
- Report results with commit hash, subject, changed files, and
git status --short.
Guardrails
- Do not use
--amendunless the user explicitly asks. - Do not add Co-Authored-By footer unless the user explicitly asks.
- Base the message on diffs, not filenames alone.
- Avoid filler text; include only details that improve scanability.
