# OpenCommit

> AI-powered CLI tool that auto-generates meaningful git commit messages in seconds using GPT, Claude, Ollama, and other LLM providers.

OpenCommit is an open-source CLI tool created by Dima Sukharev that uses large language models to automatically generate meaningful, conventional commit messages from your staged git changes. It runs with a single `oco` command, supports every major LLM provider, and won the GitHub 2023 hackathon. The project is published under the MIT license and all commits in its own repository are authored by OpenCommit itself.

## What It Is

OpenCommit is a command-line git commit message generator that reads your staged diff and sends it to an LLM to produce a structured, human-readable commit message in about two seconds. It defaults to OpenAI's `gpt-4o-mini` model but supports OpenAI, Anthropic (Claude), Azure OpenAI, Google Gemini, DeepSeek, Flowise, Ollama, llama.cpp, and the aimlapi gateway — essentially any provider with an OpenAI-compatible API endpoint. The tool follows the Conventional Commits specification by default and optionally integrates with `@commitlint` to respect per-repo commit rules.

## Setup Path

Installation is a single npm command:

```
npm install -g opencommit
```

After setting an API key with `oco config set OCO_API_KEY=<key>`, the workflow is:

- `git add <files>` (or let `oco` stage everything)
- `oco` — generates and confirms the commit message

Configuration lives in a global `~/.opencommit` file or a per-repo `.env` file. Local config takes priority over global config, making it easy to use different models or emoji settings per project.

## Key Capabilities

- **Multi-provider model support**: switch providers and models via `oco config set OCO_AI_PROVIDER` and `oco config set OCO_MODEL`
- **Local inference**: run fully offline with Ollama (default model: mistral) or llama.cpp by pointing `OCO_API_URL` at a local server
- **Git hook integration**: install as a `prepare-commit-msg` hook with `oco hook set` so it fires automatically on every `git commit` and integrates with IDE source control panels
- **GitHub Actions support** (beta): a workflow action that rewrites commit messages on every push to non-main branches
- **GitMoji support**: optionally prefix messages with emoji from the GitMoji spec; a `--fgm` flag enables the full specification
- **Locale support**: generate commit messages in any language via `OCO_LANGUAGE`
- **File ignore list**: a `.opencommitignore` file prevents large assets or sensitive files from being sent to the LLM
- **Message templates**: embed issue/PR numbers around the generated message using `OCO_MESSAGE_TEMPLATE_PLACEHOLDER`
- **Model management**: `oco models` lists available models for the current provider; models are cached for 7 days

## Why It Got Attention

The project won the GitHub 2023 hackathon and has accumulated over 7,400 GitHub stars with 432 forks, according to the repository metadata. The self-dogfooding approach — every commit in the OpenCommit repo is generated by OpenCommit — serves as a live demonstration of the tool's output quality. The README describes it as "top #1 and most feature rich GPT wrapper for git."

## Update: Version 3.3.7

The npm package shows version 3.3.7 published 3 days ago (as of the crawl date), with 140 total versions released since the project launched in March 2023. Recent additions include llama.cpp provider support, model caching with a 7-day TTL, the `oco models` command for provider-specific model discovery, custom HTTP header support via `OCO_API_CUSTOM_HEADERS`, and proxy configuration. The GitHub Action release track is separately versioned (latest: `github-action-v1.0.2`). Active weekly downloads of approximately 2,133 on npm indicate ongoing community use.

## Features
- AI-generated conventional commit messages
- Multi-provider LLM support (OpenAI, Anthropic, Azure, Gemini, DeepSeek, Flowise, aimlapi)
- Local inference via Ollama and llama.cpp
- Git prepare-commit-msg hook integration
- GitHub Actions workflow support (beta)
- GitMoji emoji prefix support
- Full GitMoji specification flag (--fgm)
- Skip confirmation flag (--yes)
- Per-repo and global configuration
- Locale/language configuration for commit messages
- commitlint integration
- Message template placeholder support
- File ignore list via .opencommitignore
- Model management with 7-day caching
- Proxy support
- One-line commit mode

## Integrations
OpenAI, Anthropic Claude, Azure OpenAI Service, Google Gemini, DeepSeek, Flowise, aimlapi, Ollama, llama.cpp, GitHub Actions, commitlint, GitMoji

## Platforms
WEB, API, CLI

## Pricing
Open Source

## Version
3.3.7

## Links
- Website: https://www.npmjs.com/package/opencommit
- Repository: https://github.com/di-sukharev/opencommit
- EveryDev.ai: https://www.everydev.ai/tools/opencommit
