Getting started
Install gitmit and write your first commit message.
Why gitmit
Most AI commit tools send your whole diff to a model and paste back whatever comes out. gitmit is built differently:
- Rules first, AI second. The commit type (
feat,fix,docs, ...) and scope are worked out from your changes by deterministic rules. When the rules are sure (only tests changed, only docs changed, a version bump), the AI is not allowed to override them. The model's job is the part rules can't do: describing what changed and why. - Your team's rules, enforced. If your repository uses commitlint, every suggestion is checked against it before you see it. Allowed types, scopes, length limits and ticket IDs come from your config.
- Secrets never leave your machine. Before anything is sent to a remote AI, gitmit scans for API keys, tokens, private keys and files like
.env. If it finds one, nothing is sent. - Works offline. No API key? gitmit still writes messages, using rules alone. Prefer local models? Use Ollama.
- Splits messy changes. Staged three unrelated things at once?
gitmit splitturns them into focused commits, safely. - Noise is ignored. Lockfiles, build output, minified files, snapshots and binaries are recognized and never sent to a model, so they don't drown out the real change or cost you tokens.
Install
Requires Node.js 20.12 or later and git.
npm install -g @gitmit/cli
This installs the gitmit command. To see it work before installing anything, paste a diff into the online demo. It runs offline in your browser.
To try the CLI without installing:
npx @gitmit/cli
Quick start
git add -A # stage your changes as usual
gitmit # get suggestions, pick one, commit
gitmit shows three suggestions. Use the arrow keys to pick one, then:
- Commit: commit with that message.
- Edit in your editor, then commit: opens your usual git editor with the message filled in.
- Back to the suggestions: pick a different one.
You can also choose Generate new suggestions or Cancel from the list.
Committing is not pushing
Like git commit, gitmit saves commits in your local repository. To send them to GitHub (or any remote), run git push, or let gitmit do it:
gitmit --push # commit, then push
gitmit split --push # create all the split commits, then push once
To always push, set "push": true in your config; --no-push skips it for one run. On a branch that has never been pushed, gitmit pushes to origin (or your remote.pushDefault) and sets it as the upstream. If a push fails, for example because the remote has commits you don't, your commits are kept and git's explanation is shown; pull, then push again.
Without an API key, gitmit uses offline rules and tells you so. For better messages, add a key (next section).