gptcommit  by zurawiki

Git hook for LLM-powered commit messages

created 2 years ago
2,391 stars

Top 19.7% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a Git prepare-commit-msg hook that leverages Large Language Models (LLMs) to automatically generate descriptive commit messages. It's designed for developers who want to streamline their commit workflow and ensure high-quality, informative commit messages without manual effort.

How It Works

The tool acts as a Git hook, intercepting the commit process. It analyzes code changes (diffs) and uses an LLM, defaulting to OpenAI's GPT-3 (text-davinci-003), to generate a commit title and body. This approach automates a often tedious task, improving commit history clarity and consistency.

Quick Start & Requirements

  • Install: cargo install --locked gptcommit or brew install zurawiki/brews/gptcommit (macOS).
  • Hook Installation: Run gptcommit install within a Git repository.
  • Prerequisites: OpenAI API key, Rust and Cargo toolchain (for Codespaces).
  • Configuration: OpenAI API key and base URL can be set via gptcommit config set or environment variables (OPENAI_API_KEY, OPENAI_API_BASE).
  • Docs: Announcement Blog Post

Highlighted Details

  • Supports multiple OpenAI models and custom API endpoints.
  • Configurable output language (English, Chinese, Japanese).
  • Allows re-summarizing amended commits.
  • Supports proxy configuration for OpenAI requests.

Maintenance & Community

The project is actively maintained by zurawiki. A VSCode extension is available, indicating community interest. Issues can be reported on the repository.

Licensing & Compatibility

  • License: MIT License.
  • Compatibility: Permissive MIT license allows for commercial use and integration with closed-source projects.

Limitations & Caveats

The tool's cost is directly tied to OpenAI API usage, which can be significant given the token consumption for diff data. By default, it skips amending commits, though this behavior can be configured.

Health Check
Last commit

3 days ago

Responsiveness

1 day

Pull Requests (30d)
2
Issues (30d)
0
Star History
21 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.