Skip to main content

A project to generate commit messages using AI

Project description

🤖 AI Commit Message

📚 Table of Contents

🚀 Tl;DR

  • 🤖 An pre-commit hook that generates the perfect commit message for you

  • 🌐 Supports all projects and programming languages, built on the pre-commit git hooks framework

  • 🔗 Works alongside all your other git hooks

📺 Usage

TODO - Insert video of usage

This tool currently supports the following LLM source...

🚀 Let's Get Started

To install the AI Commit Message tool, run:

pip install git-ai-commit

🤖 Auto Setup

  1. Run the auto setup command:
git-ai-commit hook --setup
  1. Set your OpenAI key:
git-ai-commit config --openai-key=<insert-your-key>

To uninstall the hook, run:

git-ai-commit hook --remove

🛠️ Integrate with pre-commit framework

git-ai-commit integrated 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 

🚨 Make sure you include prepare-commit-msg in default_install_hook_types🚨

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 git hooks script
pre-commit install 
  1. Setup your OpenAI key, see their docs for help
git-ai-commit config --openai-key=<insert-your-key>

🛠️ CLI

Subcommands

config: This subcommand allows you to show your current config settings

git-ai-commit config

Config flags are used to configure various settings in your configuration.

  • 🔑 --openai-key, -k: This flag allows you to set a new or update the OpenAI API key for the CLI to use. Replace <your-new-key> with your actual API key to enable the functionality.

    git-ai-commit config --openai-key=<your-new-key> 
    
  • 🔑 --anthropic-key, -a: This flag allows you to set or update the Anthropic API key for AI-powered commit messages.

    git-ai-commit config --anthropic-key=<your-anthropic-key>
    
  • 🌐 --ollama-url, -ou: This flag allows you to set the Ollama URL for local LLM models.

    git-ai-commit config --ollama-url=<ollama-url>
    
  • 🔄 --reset, -r: Use this flag to reset the entire configuration database to its default state.

    git-ai-commit config --reset
    

    This will reset all settings, including the OpenAI API key and logger status

  • 🖨️ --logger, -l: This flag displays the log status for the CLI

    git-ai-commit config --logger=<boolean>
    
  • 🧠 --model, -m: This flag allows you to set the OpenAI model to use for generating commit messages.

    git-ai-commit config --model=<model-name>
    
  • 📚 help, -h: This subcommand displays a list of all available commands and their usage, helping users understand how to interact with the CLI.

    git-ai-commit help
    

🤝 Wanna Contribute?

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

🎉 Fun Facts

  • 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.2.tar.gz (14.4 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