Skip to main content

A project to generate commit messages using AI

Project description

🤖 git-ai-commit

Current version

Tl;DR

  • AI that writes your commit messages.

  • A CLI and git hook that summarizes your changes every time you run git commit.

  • Integrates with the pre-commit framework, working alongside all your git hooks.

📺 Usage

Usage Demo

git-ai-commit currently support the following LLM providers...

🚀 Let's Get Started

  1. Install the git-ai-commit tool via pip
pip install git-ai-commit

git-ai-commit --version # Check the installed version 
  1. Start configuring your tool
git-ai-commit config --setup

🪝 Integrate with pre-commit framework

git-ai-commit integrates easily with your other git hook using the pre-commit framework.

  1. Install the pre-commit git hooks framework
brew install pre-commit
pre-commit --version 
  1. Create a .pre-commit-config.yaml files and add the following config.
touch .pre-commit-config.yaml 
default_install_hook_types: 
  # make sure you include `prepare-commit-msg` in `default_install_hook_types`
  - prepare-commit-msg
repos:
  - repo: https://github.com/ming1in/ai-commit-msg
    rev: v1.0.0
    hooks:
    -   id: git-ai-commit
  1. Based on the config above, install your pre-commit hook scripts.
pre-commit install 
  1. Setup your OpenAI key, see their docs for help.
git-ai-commit config --openai-key=...

🛠️ CLI Commands & Options

git-ai-commit config

Display your current config settings. Option flags can be used to configure various settings in your configuration. For example...

git-ai-commit config

git-ai-commit config --openai-key=... --model=gpt-4o-mini

-k --openai-key

Set or update the OpenAI API key to access their GPT models.

-a --anthropic-key

Set or update the Anthropic API key to access their Claude models.

-m --model

default: "gpt-4o-mini"

Select a model to power our tool from our supported provider. To use a Ollama model, prefix ollama/<model>.

-ou --ollama-url

default: "http://localhost:11434/api/chat"

Set the URL for interacting with your local Ollama models.

-s --setup

Config your git hook, model, and API keys via the NUX flow.

-l --logger

default: false

A toggle for enabling logs that are saved to a local file - .git/ai_commit_message.log. This was intended to be used as a local debug tool.

-r --reset

Resets your entire config settings to the default state. This will reset all settings, including API keys and model.

-p --prefix

Set a prefix for the generate commit messages.


📌 git-ai-commit help, -h

Displays a list of available command and options to help you setup our tool.

git-ai-commit help # -h

🪝 git-ai-commit hook

Manage and setup git-ai-commit as a prepare-commit-msg git hook.

git-ai-commit hook --setup

-s --setup

Adds a basic git hook by generating a .git/hooks/prepare-commit-msg script in your git repo.

-r --remove

Removes the git hook.

-x --run

Executes the custom logic for our git hook. This option was intended to only run from the prepare-commit-msg git hook.

🤝 Wanna Contribute?

If you would like to contribute code and improve our product, please read our Local Development Wiki to get started.

🎉 Fun Facts

  • In this repository, every commit prefixed with was generated by AI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_ai_commit-1.0.4.tar.gz (14.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page