Skip to main content

AI-powered git commit message generator

Project description

Genaicommit: Generate AI-Powered Git Commit Messages

Genaicommit is a command-line tool that automates the generation of git commit messages using OpenAI's language models. It ensures your commit messages are concise, informative, and follow conventional commit standards.

Features

  • Generates concise git commit messages based on diff.
  • Supports different commit message formats such as conventional commits.
  • Integrates with git to ensure the tool is usable directly within a repository.
  • Adds emojis to commit messages with devmoji (optional).

Requirements

  • Python 3.6+
  • Git
  • OpenAI API Key

Installation

You can install genaicommit using pip. First, ensure you have pip installed, then run:

pip install genaicommit

Setup

  1. Generate an OpenAI API key from the OpenAI website.
  2. Configure genaicommit with your OpenAI API key (not required if you have OPENAI_API_KEY environment variable set)
genaicommit config set OPENAI_API_KEY=<your_api_key>

Configuration

You can configure genaicommit using the config set command. Here are the available configuration keys:

  • model: The OpenAI model to use (default: gpt-4).
  • devmoji: Whether to use devmoji for commit messages (default: false).
  • type: The type of commit message format (default: conventional).
  • max-length: The maximum length of the commit message (default: 50).
  • locale: The language of the commit message (default: en).
  • OPENAI_API_KEY: Your OpenAI API key for authenticating API requests.
  • OPENAI_BASE_URL: The base URL for the OpenAI API (default: https://api.openai.com/v1).

Example:

genaicommit config set model=gpt-3.5-turbo (default: model)
genaicommit config set max-length=72 (default: 50)
genaicommit config set OPENAI_BASE_URL=http://localhost:11434/v1 (default https://api.openai.com/v1)

Usage

  1. Navigate to any git repository.
  2. Stage your changes:
git add <files>
  1. Run genaicommit to generate and approve a commit message:
genaicommit
  1. Run genaicommit with the -g option to generate multiple commit messages:
genaicommit -g 5

Example

cd your-git-repo
git add .
genaicommit

Follow the prompts to approve the commit message and commit the changes.

Options

  • -g, --generate N: Generate N commit messages (default is 1).
  • config set KEY=VALUE: Set a configuration key to a value.
  • -h, --help: Show the help message and exit.

License

This project is licensed under the MIT License.

#Credits This project was inspired by aicommits, devmoji, and commitizen.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

genaicommit-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file genaicommit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: genaicommit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for genaicommit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab20e462ab60367f34714ca04bc0d9db8bd1f7b8c4e7e4a5af651edbd1e794c4
MD5 1157d808e05e56f0e2a5e8c372632e73
BLAKE2b-256 cc74265e77a6f7988a6b4d39ab4524f79d1844f88cd87f234c1414afd83bb3d5

See more details on using hashes here.

Supported by

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