gptcommit

A git prepare-commit-msg hook for authoring commit messages with LLMs.

What is gptcommit?

A git prepare-commit-msg hook for authoring commit messages with LLMs.

Overview of gptcommit

What it is

gptcommit is a command-line tool that installs as a git prepare-commit-msg hook. It uses an OpenAI language model to automatically generate commit messages based on the staged changes in a repository. The tool is written in Rust and is open source under the MIT license.

Key features

  • Generates commit messages automatically using an OpenAI language model (default model is gpt-6-luna with low reasoning effort and a 2,048-token limit).
  • Supports configuration via a TOML file at $HOME/.config/gptcommit/config.toml, per-repository settings at $GIT_ROOT/.git/gptcommit.toml, and environment variables prefixed with GPTCOMMIT__*.
  • Allows ignoring specific files from diff analysis using Git-style patterns in the file_ignore setting.
  • Supports custom OpenAI API keys, base URLs, models, proxy settings, and output language (English, 简体中文, 繁體中文, 日本語).
  • Provides config set, config get, and config delete subcommands to manage settings.
  • Quiet by default; verbose logging can be enabled with --verbose.

Use cases

Use gptcommit to automatically generate descriptive commit messages for git repositories, reducing the time spent writing commit messages. It is useful for developers who want to focus on coding while still maintaining clear and comprehensive commit history. The tool can be configured to work with different OpenAI models and languages, making it adaptable to various workflows and team preferences.

Getting started

Install gptcommit with Cargo:shcargo install --locked gptcommitOn macOS, install via Homebrew:shbrew install zurawiki/brews/gptcommitIn your git repository, install the hook and provide an OpenAI API key:gptcommit install

License and pricing

This project is licensed under the MIT License. The tool is open source and free to use. Usage of the OpenAI API requires an API key and may incur costs based on OpenAI's pricing.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/zurawikigptcommit.svg)](https://yunodb.com/tools/zurawikigptcommit?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/zurawikigptcommit?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/zurawikigptcommit.svg" alt="Featured on YunoDB" height="20"></a>