OpenCommit — AI-Powered Git Commit Messages
OpenCommit auto-generates meaningful git commit messages using AI. 7.2K+ stars. Claude, GPT, Ollama, git hook integration. Open source.
Staging sûr pour cet actif
Cet actif est d'abord staged. Le prompt copié demande à l'agent d'inspecter les fichiers staged avant d'activer scripts, config MCP ou config globale.
npx -y tokrepo@latest install 8f087c35-53cf-4194-8342-c3ed43018302 --target codexStage les fichiers d'abord; l'activation exige la revue du README et du plan staged.
What it is
OpenCommit is a CLI tool that analyzes your staged git changes and generates meaningful commit messages using AI. It reads the diff, sends it to an LLM (Claude, GPT, or local models via Ollama), and proposes a conventional commit message. It supports git hook integration so commit messages are generated automatically on every commit.
Developers who want consistent, descriptive commit messages without spending time writing them benefit from OpenCommit. Teams enforcing conventional commit standards find it especially useful.
How it saves time or tokens
Writing good commit messages takes 30-60 seconds per commit. OpenCommit generates one in about 1 second. Over a day with dozens of commits, this saves meaningful time. The AI reads the full diff context, producing messages that are often more descriptive than hastily written manual ones. The token_estimate per commit is approximately 389 tokens.
How to use
- Install OpenCommit globally via npm
- Configure your AI provider and API key
- Stage your changes and run
ocoinstead ofgit commit
Example
# Install
npm install -g opencommit
# Configure provider
oco config set OCO_API_KEY=sk-ant-your-key
oco config set OCO_MODEL=claude-sonnet-4-20250514
# Use: stage changes and run
git add .
oco
# Output: feat(auth): add JWT token refresh logic with expiry check
# Or install as git hook (auto-generate on every commit)
oco hook set
git add . && git commit # Message generated automatically
Related on TokRepo
- AI tools for coding — Browse AI development tools
- Featured workflows — Discover top-rated tools and workflows
Common pitfalls
- Large diffs (many files changed) produce longer context and higher token costs; commit frequently in small batches
- The git hook runs on every commit including rebases and merges; disable it for non-standard commits
- Generated messages may not match your team's exact commit convention; customize the prompt template in config
Questions fréquentes
OpenCommit supports OpenAI (GPT-4, GPT-4o), Anthropic (Claude), local models via Ollama, and any OpenAI-compatible endpoint. You configure the provider and model in the oco config.
Yes. Run `oco hook set` to install a prepare-commit-msg hook. Every `git commit` will automatically generate an AI commit message. Run `oco hook unset` to remove it.
Yes. OpenCommit generates messages in Conventional Commits format by default (feat:, fix:, docs:, etc.). You can customize the format through configuration.
Cost depends on diff size and model. A typical commit with Claude costs fractions of a cent. Large diffs with GPT-4 may cost a few cents. Using Ollama with local models is free.
Yes. By default, OpenCommit shows the generated message and asks for confirmation. You can edit it, regenerate, or cancel. Auto-approve mode is available but not recommended.
Sources citées (3)
- OpenCommit GitHub— AI-powered git commit message generator
- OpenCommit README— Supports Claude, GPT, and Ollama providers
- Conventional Commits— Conventional Commits specification
En lien sur TokRepo
Source et remerciements
di-sukharev/opencommit — 7,200+ GitHub stars
Fil de discussion
Actifs similaires
AI Commit — Auto-Generate Git Commits with AI
CLI tool that generates conventional commit messages from your staged changes using AI. Supports Claude, GPT-4, and local models. One command for perfect commit messages. 3,000+ stars.
Fireworks Tech Graph — AI-Powered Technical Diagram Generator
An open-source tool that generates production-quality SVG and PNG technical diagrams from natural language descriptions, supporting UML, architecture, and AI workflow patterns.
Lefthook — Fast Git Hooks Manager in Go
Blazing-fast Git hooks manager written in Go. Run linters, formatters, and tests on git commit/push in parallel. Zero-dependency single binary. Replaces Husky + lint-staged. 5,000+ stars.
ungit — Visual Git Made Simple in Your Browser
A web-based visual git client that runs locally and makes branching, merging, and history exploration intuitive for any experience level.