Skip to main content

A simple command to generate git commit messages from the current diff file

Project description

GitCo Package

PyPI version

GitCo is a command-line tool designed to assist in generating git commit messages by analyzing the current changes (diff) in your repository. It uses a Language Model (LLM) to suggest meaningful and concise commit messages, saving you time while keeping your commit history clear and informative.

Features

  • Commit Message Suggestions: GitCo suggests commit messages based on your staged changes.
  • LLM Integration: Uses powerful language models via external providers to create context-aware commit messages.
  • Interactive Workflow: Edit or approve the suggested message before finalizing your commit.

Installation

Install the GitCo package using pip:

pip install gitco

Configuration

GitCo requires access to an LLM provider to generate commit messages. You can configure the tool in two ways:

Option 1: Using a .env.gitco file

  1. In your project directory, create a .env.gitco file.
  2. Add the following environment variables with the details of your LLM provider:
GITCO_PROVIDER=Azure
GITCO_API_KEY="YOUR_API_KEY"
GITCO_API_VERSION="2024-08-01-preview"
GITCO_DEPLOYMENT_NAME="YOUR_DEPLOYMENT_NAME"
GITCO_ENDPOINT="https://YOUR_ENDPOINT.openai.azure.com/"

With this method, one needs to execute the gitco command from the same directory as the .env.gitco file.

Option 2: Export environment variables

Alternatively, you can set these environment variables directly in your terminal or CI environment. Use the following commands:

export GITCO_PROVIDER=Azure
export GITCO_API_KEY="YOUR_API_KEY"
export GITCO_API_VERSION="2024-08-01-preview"
export GITCO_DEPLOYMENT_NAME="YOUR_DEPLOYMENT_NAME"
export GITCO_ENDPOINT="https://YOUR_ENDPOINT.openai.azure.com/"

Notes:

  • Replace the placeholder values (e.g., YOUR_API_KEY) with your actual credentials and API details.
  • Ensure that your API key and other credentials are securely stored and not exposed in version control.

Providers

GitCo is designed to support multiple LLM providers for flexibility and future expansion. Currently, it supports Azure OpenAI as the LLM provider.

In the future, GitCo will support additional providers, allowing users to choose the LLM service that best fits their needs. Planned future providers include:

  • OpenAI API (non-Azure)
  • Anthropic
  • Google Gemini
  • Hugging Face
  • Ollama
  • ...

For each provider, GitCo will automatically adapt based on your configuration, as set in your environment or .env.gitco file. Stay tuned for updates!

Usage

After configuration, you can use GitCo to generate a suggested commit message. Here's how it works:

  1. Generate the Suggestion: Run the following command from your git repository to generate a commit message based on the staged changes:

    gitco
    
  2. Edit or Approve the Commit Message:

    • GitCo will suggest a commit message based on the diff.
    • You have the option to edit the suggested message if necessary.
    • Once satisfied, you can approve the commit.
  3. Finalizing the Commit:

    • If the suggested message fits your needs perfectly, you can directly validate it, and GitCo will automatically run the following command to finalize the commit:

      git commit -m "Generated commit message"
      
    • If you edit the message, GitCo will use your final version for the commit. After approval, it will automatically execute the commit.

This allows for a seamless, interactive workflow where you remain in control of the final commit message.

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

gitco-0.0.6.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

gitco-0.0.6-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file gitco-0.0.6.tar.gz.

File metadata

  • Download URL: gitco-0.0.6.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for gitco-0.0.6.tar.gz
Algorithm Hash digest
SHA256 c204f7bb467f4b7420c9b211a7eedbb23fb74a4a924a63144b2cdef83ec14507
MD5 3f60dcd67cae965b32fcc03ff4ca62f8
BLAKE2b-256 985654fbca0392c21acbe6782df1340f382cc3fb2ebf30e145f9b111340f9acb

See more details on using hashes here.

File details

Details for the file gitco-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: gitco-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for gitco-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e799400b9d0b3348ba5c51306424aadb61b73ee8d8bf22a52a0cb1ff14c468b0
MD5 9893f6bfe8fc5a42f868715fb2ea9bc7
BLAKE2b-256 5c867b0211c41830dbcf587376b4fcaccc862441b9bbd19681422d11720b4f40

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