@gitmit/cli
v0.8.0
Published
Generate clean, convention-compliant git commit messages from your staged changes.
Maintainers
Readme
gitmit
Generate clean, Conventional Commits messages from your staged changes. Works offline, keeps secrets on your machine, and respects your team's rules.
Website and live demo · Documentation
npm install -g @gitmit/cli
git add -A
gitmitgitmit shows three suggestions. Pick one to commit, edit it first, or ask for new ones.
AI providers
gitmit works without any setup using offline rules. For better messages, add an API key to ~/.config/gitmit/.env (on Windows, %APPDATA%\gitmit\.env):
OPENAI_API_KEY=sk-...
# or
ANTHROPIC_API_KEY=sk-ant-...Keys can also come from environment variables. Local models work through Ollama with --provider ollama.
Or use your gitmit account: save your key once at gitmit-frontend.vercel.app/account, then run gitmit login here. The same key works in VS Code and on the website. Your changes are still scanned and summarized on your machine; only the summary is relayed.
Before anything is sent to a remote provider, gitmit scans the changes for API keys, tokens, private keys and files like .env. If it finds one, it stops and sends nothing unless you choose to send a redacted version.
Usage
gitmit Suggest messages for staged changes and commit
gitmit --dry-run Show suggestions without committing
gitmit --yes Commit the top suggestion without asking
gitmit --provider <name> openai, anthropic, ollama or rules (offline)
gitmit --model <name> Model for the provider
gitmit --redact Redact secrets instead of stopping
gitmit --push Push after committing (gitmit commits locally, like git commit)
gitmit split Split staged changes into several focused commits
gitmit pr Write a pull request title and description for this branch
gitmit pr --create ...and push the branch and open it (--draft for a draft)
gitmit pr --update ...and update the open pull request
gitmit check Check this branch's commit messages (and a PR title) against your rules
gitmit release Changelog, next version and tag from the commits since the last release
gitmit login Sign in with GitHub to use the key saved in your gitmit account
gitmit logout Sign out on this computer
gitmit account Show your account and saved keys
gitmit init Create a starter .gitmitrc.json
gitmit config Show the settings in effect
gitmit hook install Fill in a suggestion whenever you run `git commit`
gitmit hook uninstall Remove the hookSplitting messy changes
gitmit split turns one big set of staged changes into several focused commits. It groups the changes by intent (with an AI provider) or by area and kind of change (offline), writes a message for each, and lets you move changes between commits or edit messages before anything happens.
It only touches the staging area, never your files. The plan is rehearsed in a temporary index first, and if anything fails, such as a commit hook, your original commit and staged changes are restored exactly. Use --dry-run to see the plan, or --yes to apply it without asking.
Pull requests
gitmit pr describes your whole branch for reviewers: a Conventional Commits title (it becomes the commit when the pull request is squash-merged) and a description with a summary, the changes and how to test them. If the repository has a pull request template, gitmit fills it in. The base branch is the remote's default branch; use --base <branch> to pick another.
With GitHub's CLI installed, --create pushes the branch and opens the pull request, and --update replaces the title and description of the one already open.
Checking messages
gitmit check checks the commits on your branch, and optionally a pull request title (--title), against your gitmit config or your commitlint rules. It exits with 1 when something needs changes, so it works in CI. Add --suggest for a fixed version of each message. There's also a GitHub Action: uses: sammy440/[email protected].
Releases
gitmit release reads the Conventional Commits since your last version tag, suggests the next version (breaking changes bump major, features minor, fixes patch), and writes the changelog section, with a short AI-written summary on top when you use an AI provider. Releasing updates CHANGELOG.md and package.json, commits and tags; then you can push it and create a GitHub release. Use --bump to pick the version, --dry-run to preview, and --yes --github in CI.
Team settings
Run gitmit init to create .gitmitrc.json, or use 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" },
ticket: { position: "suffix" }, // PROJ-123 from feat/PROJ-123-login
subjectMaxLength: 72,
bodyStyle: "bullets",
});- commitlint: if the repository has a commitlint config, gitmit follows it and lints every suggestion before showing it. Set
commitlint: falseto opt out. - Personal defaults go in
~/.config/gitmit/config.json; project settings override them. gitmit configshows the settings in effect and where each came from.
MIT licensed. Website: https://gitmit-frontend.vercel.app · Source: https://github.com/sammy440/gitmit
