commit

Generate a git commit message and apply it immediately.

Generate a git commit message and apply it immediately.

First, run git diff --staged --stat to check for staged changes.

  • If there are staged changes, run git diff --staged to see what will be committed.
  • If there are no staged changes, run git add -A to stage everything, then run git diff --staged to see what will be committed.

Also run git log --oneline -5 to understand recent context.

Then write a commit message following these rules:

  • Use Conventional Commits format: type(scope): short description
  • Types: feat, fix, docs, style, refactor, test, chore
  • Subject line: imperative tense, under 72 characters, no period at end
  • If the change needs more explanation, add a blank line then a short body (2-4 sentences max)
  • Body explains what and why, not how
  • Do not include "Generated by", "Co-Authored-By", or any meta-commentary

Before committing, run ls CHANGELOG.md 2>/dev/null to check if a changelog file exists in the repo root. If it does, regenerate the ## Unreleased section using the same rules as the /changelog command — treating the changes about to be committed as already included — and overwrite CHANGELOG.md with the result. Then stage CHANGELOG.md with git add CHANGELOG.md so it is included in the commit.

Apply the commit immediately with git commit -m "...". Show the commit message and the output of git commit so the user can see what was committed. Do not ask for confirmation first.

$ARGUMENTS