Skip to main content

AI generated commit messages

Project description

Release Notes Downloads Python Versions GitHub CI Status License: MIT

aiautocommit

Generate intelligent commit messages using AI. aiautocommit analyzes your staged changes and creates conventional commit messages, handling both small tweaks and large changesets effectively.

Yes, there are a lot of these. Main ways this is different:

  • Simple codebase
  • Ability to easily customize prompts on a per-repo basis

Installation

pip install aiautocommit

Features

  • Generates conventional commit messages
  • Customizable prompts and exclusions
  • Pre-commit hook integration
  • Supports custom config directories

Getting Started

Set your OpenAI API key:

export OPENAI_API_KEY=<YOUR API KEY>

Stage your changes and run aiautocommit:

git add .
aiautocommit

Customization

Using Config Directory

aiautocommit looks for configuration files in these locations (in priority order):

  • .aiautocommit/ in current directory
  • $XDG_CONFIG_HOME/aiautocommit/ (defaults to ~/.config/aiautocommit/)
  • Custom path via aiautocommit_CONFIG environment variable

To get started with customization:

aiautocommit dump-prompts

This creates a .aiautocommit/ directory with:

  • diff_prompt.txt: Template for generating diff summaries
  • commit_prompt.txt: Template for generating commit messages
  • exclusions.txt: List of files to exclude from processing

Installing Pre-commit Hook

To automatically generate commit messages during git commits:

aiautocommit install-pre-commit

Environment Variables

  • OPENAI_API_KEY: Your OpenAI API key
  • aiautocommit_MODEL: AI model to use (default: gpt-4-mini)
  • aiautocommit_CONFIG: Custom config directory path
  • LOG_LEVEL: Logging verbosity
  • aiautocommit_LOG_PATH: Custom log file path

Privacy Disclaimer

gpt-commit uses the OpenAI API to generate commit messages. Both file names and contents from files that contain staged changes will be shared with OpenAI when using gpt-commit. OpenAI will process this data according to their terms of use and API data usage policies. On March 1st 2023 OpenAI pledged that by default, they would not use data submitted by customers via their API to train or improve their models, and that this data will be retained for a maximum of 30 days, after which it will be deleted.

Special Thanks

This project inspired this project. It had a very simple codebase. I've taken the idea and expanded it to include a lot more features, specifically per-project prompt customization.

Related Projects

I looked at a bunch of projects before building this one.

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

aiautocommit-0.6.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

aiautocommit-0.6.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file aiautocommit-0.6.0.tar.gz.

File metadata

  • Download URL: aiautocommit-0.6.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.30

File hashes

Hashes for aiautocommit-0.6.0.tar.gz
Algorithm Hash digest
SHA256 827fac8b210032a1ed83a74992cbd24619e4e1ad483d317165472229d84a714e
MD5 3fe55936c9cdd6cd315a86f6ffa15ac0
BLAKE2b-256 f927a014c2d72fa5df55f7c58f01d5e98f3c7b5b8d7b580ed3bb4669465a1e19

See more details on using hashes here.

File details

Details for the file aiautocommit-0.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for aiautocommit-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad4ad8fa4bae15a4d7cf1fa1110fe87d428c3c28668644a924191a9112b06bc8
MD5 d8206bbff6d00a0459a32e4c4590862e
BLAKE2b-256 0c4077fc98ca3968cff91284e1a306e986b7d86a60a24cce57aacff8711116da

See more details on using hashes here.

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