Configuration

Share settings with your team, and every option explained.

Settings that should be shared by everyone on a project go in a config file committed to the repository. Create one with:

gitmit init

Config files

gitmit uses the first of these it finds in the repository root:

  1. gitmit.config.ts (also .mts, .cts, .js, .mjs, .cjs)
  2. .gitmitrc.json
  3. .gitmitrc (JSON)
  4. A "gitmit" key in package.json

A TypeScript config gets full autocomplete:

// gitmit.config.ts
import { defineConfig } from "@gitmit/cli";

export default defineConfig({
  types: ["feat", "fix", "docs", "refactor", "test", "chore"],
  scopeFromPaths: {
    "apps/web/**": "web",
    "apps/api/**": "api",
    "packages/ui/**": "ui",
  },
  ticket: { position: "suffix" },
  subjectMaxLength: 72,
  bodyStyle: "bullets",
});

This works even when gitmit is installed globally and the repository doesn't list @gitmit/cli as a dependency.

JSON configs get autocomplete through the published schema:

{
  "$schema": "https://unpkg.com/@gitmit/cli/schema.json",
  "types": ["feat", "fix", "docs", "chore"],
  "bodyStyle": "none"
}

Personal defaults

Your own preferences for every repository go in ~/.config/gitmit/config.json (%APPDATA%\gitmit\config.json on Windows), in the same format. Project settings override them.

Order of priority, highest first:

  1. Command-line flags
  2. The project config
  3. Your personal config
  4. Built-in defaults

Run gitmit config to see the result and which file each setting came from. API keys never go in config files; they belong in your environment or your personal .env.

All settings

SettingTypeDefaultWhat it does
provider"openai" | "anthropic" | "ollama" | "rules"first provider with a key, else rulesWhere suggestions come from.
modelstringper providerModel name for the provider.
typesstring[]the 11 Conventional Commits typesAllowed commit types. Custom ones like "wip" are fine.
scopesstring[]anyAllowed scopes.
scopeFromPaths{ glob: scope }built-in rulesMap paths to scopes. The first matching glob wins.
ticketobjectoffAdd a ticket ID from the branch name. See below.
subjectMaxLengthnumber (20 to 200)72Maximum header length, including any ticket.
bodyStyle"none" | "prose" | "bullets""bullets"Format of the message body.
bodyLineLengthnumber (40 to 200)72Wrap body lines at this width.
languagestring"en"Language of the description and body, e.g. "fr".
ignorestring[]noneExtra globs to treat as noise (listed, never sent to a model).
secrets.onDetect"abort" | "redact""abort"What happens when a secret is found before a remote call.
variantsnumber (1 to 5)3How many suggestions to show.
commitlintbooleantrueFollow the repository's commitlint config when there is one.
pushbooleanfalsePush after every successful commit or split.

The 11 default types are feat, fix, docs, style, refactor, perf, test, build, ci, chore and revert.

How scopes are chosen

Without scopeFromPaths, gitmit infers a scope from where the changed files live:

PathScope
apps/web/src/App.tsxweb (also packages/, services/, libs/, modules/, crates/, plugins/, extensions/)
src/auth/login.tsauth (also under lib/, app/, pkg/, internal/, cmd/)
api/handlers/users.goapi (a top-level folder, unless it's generic like docs or scripts)
README.md, src/index.tsno scope

If the changes span several scopes, gitmit leaves the scope out rather than guess. Consider gitmit split in that case.