Coding & Software

Write a Commit Message From a Diff

Writes a Conventional Commits style message from a diff, and tells you when the diff is really two commits that should be split.

Designed for general-purpose AI assistantsPublished November 2026

Customize

Fill in the fields and the prompt updates. What you type stays in this page and is never saved or sent.

Preview

Write a git commit message for the staged changes below.

Format: Conventional Commits
Allowed types and scopes in this repository: feat, fix, docs, refactor, test, chore
Ticket reference to include, if any: 

Staged diff:
{{diff}}

Requirements:
- Subject line: imperative mood, no trailing period, at most 72 characters, describing the outcome rather than the files touched.
- Body, only if the change needs one: explain why the change was made and any behavior a reader might not expect. Wrap lines at 72 characters. Do not restate the diff line by line.
- Footer: the ticket reference if I gave one, and a BREAKING CHANGE note only if the diff really breaks a public interface.

Before writing it, check whether the diff mixes unrelated changes (for example a bug fix and a formatting pass). If it does, do not write one message. Tell me how to split it into separate commits and write a message for each.

If the diff alone does not show why the change was made, write the subject from what it does and add one line telling me what to add to the body, instead of inventing a reason.

1 required field is empty and will stay as a {{placeholder}} in the copied text.

How to use it

  1. Run git diff --staged and paste the output. Staged changes only, so the message matches what will actually be committed.
  2. Fill in your repository's allowed types. A message with a type your commit linter rejects wastes a round trip.
  3. If the prompt suggests splitting the commit, take it seriously: stage the first group with git add -p and run the prompt again for each.
  4. Add the missing why yourself when the prompt asks. The reason for a change is the one thing a diff cannot contain.

Example output

Illustrative only. Real answers depend on your input and the assistant you use.

fix(cart): stop double-applying the coupon on page refresh

The coupon was re-applied whenever the cart page reloaded, because the
discount was added to the stored total instead of recomputed from the
line items. Recompute the total on every load so a refresh is a no-op.

Refs: SHOP-481

Note: this diff also reformats checkout.css. Consider moving that into a
separate "style(checkout): reformat stylesheet" commit so this fix stays
easy to revert.

Tips

Most useful for the half-finished state at the end of a long session, when you have staged more than one idea. The split suggestion is the part that improves your history.

Do not let the assistant write a "why" it cannot see. A truthful subject with a note to add context is better than a confident but invented body.

If your team squashes pull requests, the individual commit messages matter less; the same structure still works for the squash message.

  • Coding & Software

    Write a Pull Request Description

    Turns a diff and a ticket into a pull request description with context, changes, risk and a test plan that reviewers can follow.

    Customizable fields
    6 fields
  • Writing & Editing

    Write Release Notes From a Changelog

    Rewrites raw commits or changelog entries as user-facing release notes grouped by benefit, with breaking changes called out first.

    Customizable fields
    7 fields
  • Coding & Software

    Debug a Flaky Test

    Finds why a test passes sometimes and fails other times, ranks the likely causes and gives an experiment to prove each one.

    Customizable fields
    8 fields