explaingit

di-sukharev/opencommit

7,300JavaScriptAudience · developerComplexity · 2/5Setup · easy

TLDR

A command-line tool that automatically writes your git commit messages using AI, run `oco` after staging files and it reads your diff, calls an AI model, and commits in about two seconds.

Mindmap

mindmap
  root((repo))
    What it does
      AI commit messages
      Reads staged diff
      Commits in 2 seconds
    AI Providers
      OpenAI default
      Anthropic
      Ollama local
      Azure Gemini others
    Configuration
      Global settings
      Per-project .env
      GitMoji support
    Usage
      Run oco command
      Auto or confirm mode
      Any git repository
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Replace manually typing git commit messages with AI-generated ones by running `oco` after staging your changes.

USE CASE 2

Run fully offline commit-message generation by pointing OpenCommit at a local Ollama server instead of a cloud API.

USE CASE 3

Enforce GitMoji emoji conventions and consistent commit styles across a team by sharing a per-project .env config file.

Tech stack

JavaScriptNode.jsnpmOpenAI APIAnthropic APIOllama

Getting it running

Difficulty · easy Time to first run · 5min

Requires Node.js, install globally with `npm install -g opencommit` then set your API key with one config command.

No license information was mentioned in the explanation.

In plain English

OpenCommit is a command-line tool that writes your git commit messages for you using an AI model. After you stage the files you want to commit, you run oco instead of git commit, and the tool reads your changes, sends them to an AI, and commits with a generated message. The whole process takes about two seconds. It won the GitHub 2023 hackathon. The tool supports a wide range of AI providers: OpenAI (the default), Anthropic, Azure, Gemini, DeepSeek, and others. It also supports running fully offline using Ollama, which lets you run a local model like Llama or Mistral on your own machine without sending any data to an external service. You can switch providers and models through simple config commands. Configuration is quite flexible. You can set options globally for all your repositories (stored in ~/.opencommit) or per-project using a local .env file. The options cover which model to use, whether to add emoji prefixes from the GitMoji convention, whether to append a short description of what changed and why, what output language to use for the message, and whether to require manual confirmation before committing. A --yes flag skips the confirmation prompt for a fully automatic workflow. Installing it requires Node.js already on your system. Once installed globally with npm install -g opencommit, you set your API key with one command and the tool is ready to use in any repository. For Ollama, you point the tool at your local Ollama server's URL instead of an API key. All the commits in the OpenCommit repository itself were generated by OpenCommit, so you can browse the commit history there to see what the output looks like in practice. The project is available on npm and is under active development.

Copy-paste prompts

Prompt 1
I installed opencommit globally with npm. Walk me through setting my Anthropic API key and switching the model to claude-haiku-4-5 for faster, cheaper commits.
Prompt 2
I want to use opencommit with Ollama running Llama 3 locally so no code leaves my machine. What config commands do I need to run?
Prompt 3
Set up opencommit in a project so it uses GitMoji prefixes, adds a short description of what changed, generates messages in Spanish, and skips the confirmation prompt.
Prompt 4
I want to add opencommit as a git hook so every commit in my repo automatically uses AI-generated messages. Show me how to set that up with a pre-commit hook script.
Open on GitHub → Explain another repo

← di-sukharev on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.