Back to library

📝Generate Commit Messages with AI

Stop letting your git history decay into 'fix stuff' two weeks after you adopt Conventional Commits. By the end you'll have an AI commit hook reading your diff and producing a compliant message every time — and a team convention doc that makes it stick.

Foundations14 drops~2-week path · 5–8 min/daytechnology

Phase 1Why Commit Messages Decay

See why commit messages decay and what convention buys you

4 drops
  1. 'fix stuff' is what happens at 6pm on a Friday

    6 min

    Commit-message decay isn't a discipline problem — it's a friction problem. The cost of writing a good message is paid now; the benefit is paid in a future debugging session by someone who isn't you.

  2. Conventional Commits is a contract with future tooling

    6 min

    `feat:` / `fix:` / `chore:` aren't decoration — they're the inputs to automated changelog generation, semver bumps, and release filtering. Skip the prefix and the tooling can't do its job.

  3. The diff already contains the message — somewhere

    6 min

    A well-written commit message is just a lossy compression of the diff. AI tools work because that mapping is mechanical — the file paths, the verbs (added/removed), and the changed identifiers tell you 90% of what to write.

  4. Three tools, one workflow — picking by friction

    6 min

    aicommits, OpenCommit, and gptcommit all do the same thing — the choice is about CLI ergonomics, model cost, and how each handles diffs that exceed the context window.

Phase 2Wire AI Into Your Commit Flow

Wire aicommits and commit with AI three times

5 drops
  1. Install, key, run — three commands to your first AI commit

    7 min

    Getting from zero to a working AI commit message takes three commands and an API key. Most of the friction is environmental, not conceptual.

  2. Generate three real commits and compare to what you would have written

    8 min

    The way to internalize the workflow is to run it on three real changes back-to-back — not on toy examples. The third commit is the one where the habit starts to stick.

  3. Diagnose the AI's misses to spot prompt tuning needs

    7 min

    When an AI commit message is wrong, it's almost always one of four things: wrong type prefix, wrong scope, too-vague body, or missed breaking change. Each has a different fix.

  4. Know where your diff goes — cost, privacy, local models

    7 min

    Sending your diff to OpenAI is fine for OSS but a non-starter for proprietary code at many companies. The unblock is Ollama-backed tools that run the model locally.

  5. Alias it so the right command is the muscle-memory one

    7 min

    If using AI commits requires typing a longer command than not using them, you'll skip it under deadline pressure. A two-character alias makes the AI workflow the path of least resistance.

Phase 3Tune The Prompt For Your Repo

Tune the prompt for scopes, body, and breaking changes

4 drops
  1. Your monorepo has 12 workspaces — the AI defaults to none

    8 min

    Out of the box, AI commit tools either omit scope entirely or pick a too-generic one. In a monorepo, scope is the most important part of the message after the type — and it's the part the AI gets wrong without help.

  2. The body is a paragraph or it's nothing — tune for one

    7 min

    Default AI commit prompts produce either no body at all or a too-long body that restates the diff line by line. You want a third option: one short paragraph explaining the why.

  3. Teach the AI which diff shapes are breaking

    8 min

    AI tools rarely flag `feat!:` or BREAKING CHANGE: out of the box. You have to tell the model what counts as breaking in your repo — usually a short list: removed public exports, changed function signatures, renamed event names.

  4. One prompt per repo, versioned with the code

    8 min

    The right home for your AI commit prompt is in the repo itself, not in each developer's global config. That way new hires get the right behavior on day one, and the prompt evolves through PRs.

Phase 4Ship An AI Commit Hook For Your Team

Ship an AI commit hook and team convention doc

1 drop
  1. Install the hook in a real repo and document the convention

    8 min

    Install the hook in a real repo and document the convention

Frequently asked questions

What is the best AI commit message generator for my workflow?
This is covered in the “Generate Commit Messages with AI” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
How does aicommits or OpenCommit read my staged diff?
This is covered in the “Generate Commit Messages with AI” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
Will an AI commit hook follow Conventional Commits format reliably?
This is covered in the “Generate Commit Messages with AI” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
How do I customize the prompt for monorepo scopes and breaking changes?
This is covered in the “Generate Commit Messages with AI” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.
Can I run AI commit messages as a git hook for the whole team?
This is covered in the “Generate Commit Messages with AI” learning path. Start with daily 5-minute micro-lessons that build from fundamentals to hands-on application.