Skip to content

Commit command

Muhammet Şafak edited this page Jun 2, 2026 · 2 revisions

Home / Commands / commit

commitbrief commit

Generate a commit message from the staged diff and, after you confirm, run git commit. This is the only CommitBrief command that writes to git — every review path is read-only. It never auto-stages and never edits files; it commits only what you already staged, and only on your confirmation (or --yes).

Synopsis

commitbrief commit [--type <format>] [--generate <N>] [--yes] [provider flags]

Takes no positional arguments. The scope is always the staged index, so the --staged / --unstaged scope flags do not apply.

What it does

  1. Reads the staged diff (errors if nothing is staged).
  2. Prints the detected staged files.
  3. Runs the pre-send .commitbrief/** guard, the secret scan, and the cost preflight on the diff — exactly as a review does.
  4. Asks the configured provider for the commit message(s) in a single call.
  5. Shows the message (or a selector for --generate N) and asks to confirm, pre-selected on Yes.
  6. On Yes (or --yes), runs git commit and prints git's summary line.

The message is passed to git via git commit -F - (stdin), so multi-line bodies commit verbatim. Commit hooks run normally (no --no-verify); a failing pre-commit hook surfaces as an error.

Flags

Flag Default Description
-t, --type <format> plain (or commit.type) Message format. One of plain, conventional, conventional+body, gitmoji, subject+body.
-g, --generate <N> 1 (or commit.generate) Produce N alternatives (1–10) and pick one in an arrow-key selector. A single provider call generates all N.
--provider, --model, --cli from config Select the backend, identical to a review.
--yes off Commit the first suggestion with no prompt (non-interactive). Does not bypass the secret scan or cost preflight.
--no-cost-check, --allow-secrets, --no-cache off Same meaning as on a review.
--show-prompt off Print the exact prompt that would be sent, then exit (no provider call).

Defaults resolve flag > config > built-in. The commit.type and commit.generate config keys set the defaults when the flags are omitted.

Message types

--type Output
plain (default) A single short imperative subject line, no type prefix.
conventional type(scope): subject (Conventional Commits). Subject only.
conventional+body Conventional subject plus a generated body.
gitmoji An emoji matching the change, then a short subject.
subject+body A subject line plus a generated body.

Messages are always written in English, regardless of --lang (which still controls the CLI's own strings).

Behavior in CI / non-interactive shells

Committing needs a confirmation that can only be shown on a TTY. On a non-TTY (piped or CI) without --yes, commit errors before spending anything. Pass --yes to commit the first suggestion unattended. Even with --yes, a detected secret (non-TTY) or an over-threshold cost estimate still aborts.

Examples

# Suggest a plain message, confirm, commit.
commitbrief commit

# Conventional Commit with a generated body.
commitbrief commit -t conventional+body

# Offer four alternatives and choose one.
commitbrief commit -g 4

# Use a specific backend for this commit only.
commitbrief commit --provider openai --model gpt-5.4-mini

# Non-interactive: commit the first suggestion.
commitbrief commit --yes

# See the prompt without calling a provider.
commitbrief commit --show-prompt

Relationship to --suggest-commit

The --suggest-commit review flag is a read-only sibling: it prints one Conventional Commit message after a review and never touches git. commit is the standalone, write-capable command with format and alternative-count options. Both are supported.

See also

Clone this wiki locally