di-sukharev/opencommit
top #1 and most feature rich GPT wrapper for git — generate commit messages with an LLM in 1 sec — works with Claude, GPT and every other provider, supports local Ollama models too
OpenCommit – AI‑powered commit‑message generator
What it is – A Node‑JS command‑line tool (oco) that reads the files you have staged for a Git commit, sends a diff (or the whole file contents) to a large language model and returns a concise, conventional‑style commit message. The message can include GitMoji emojis, a short description, and optional “why” notes.
How it works –
- You install the package globally (
npm i -g opencommit). - You provide an API key for any supported LLM provider (OpenAI, Anthropic, Azure, Ollama, llama.cpp, Gemini, Flowise, DeepSeek, OpenRouter, OrcaRouter, etc.).
- Running
oco(orgit add … && oco) sends the staged changes to the chosen model via the provider’s REST endpoint. - The model returns a commit message which the tool feeds to
git commit -m "…". Optional flags let you skip the confirmation prompt, add emojis, or force a one‑line message.
Key features (as described in the README)
- Multi‑provider support – works with cloud APIs (OpenAI, Anthropic, Azure, etc.) and local models via Ollama or a llama.cpp server.
- Configurable model & language – default is
gpt‑4o‑mini; you can switch to any model name the provider offers and set the output language (e.g.,de,fr). - GitMoji integration – enable a short set of 10 emojis or the full GitMoji spec with
--fgm. - Commit‑hook & GitHub Action –
oco hook setinstalls aprepare‑commit‑msghook; a beta GitHub Action can rewrite new commits on push. - Per‑repo and global configuration – stored in
~/.opencommitor a.envfile in the repo; many knobs (OCO_EMOJI,OCO_DESCRIPTION,OCO_WHY, token limits, proxy, etc.). - Ignore files –
.opencommitignore(local) and~/.opencommitignore(global) let you exclude large assets or secrets from being sent to the LLM. - Model management –
oco modelslists cached provider models;--refreshforces an update. - Template placeholder – you can embed a custom string (
$msg) inside a larger template, e.g.,oco '#205: $msg'.
Typical workflow
# Install once
global npm i -g opencommit
# Set your API key (once per machine or per repo)
oco config set OCO_API_KEY=sk-…
# Stage changes (or let oco do it) and generate a commit
git add .
oco # opens a confirmation prompt
# or skip confirmation
oco --yes
Running with a local model (example for Ollama):
ollama run mistral # pulls the model once
oco config set OCO_AI_PROVIDER=ollama OCO_MODEL=llama3:8b
oco
GitHub Action usage – add .github/workflows/opencommit.yml as shown in the README; the action rewrites each new commit on push using the configured model and options.
Why it matters – Writing clear, conventional commit messages is tedious. OpenCommit automates the process, ensuring consistency, better changelogs, and easier collaboration, while giving developers control over style, language, and cost.
Installation – npm install -g opencommit
Documentation – the repository’s README (commands: oco, oco config, oco hook, oco models, etc.)
License – not specified in the excerpt; check the repo for the actual license.
Related
- Project
- Project
- Project
- Project
- Project