Skip to main content

AI-powered Git commit message generator.

Project description

Commi: AI-powered Git Commit Message Generator

Commi is an AI-powered tool that automatically generates Git commit messages based on your code changes. It uses Google's Gemini AI to analyze your Git diffs and suggest meaningful, descriptive commit messages. Commi helps save time and ensures your commit history is consistent and descriptive.

Features

  • AI-powered commit message generation: Suggest commit messages based on the code changes using Google's Gemini AI.
  • Staged changes support: Generate commit messages based on the current staged changes.
  • Direct commit: Generate and commit the suggested commit message directly to your repository.
  • Clipboard integration: Optionally copy the generated commit message to your clipboard for easy pasting.

Installation

Build from source

To install Commi manually, follow these steps:

  1. Clone the repository:

    git clone https://github.com/Mahmoud-Emad/commi.git
    cd commi
    
  2. Install the dependencies:

    poetry install
    
  3. Build the executable:

    ./build.sh
    # This aslo will move the excutable to `/usr/local/bin`
    
  4. Run the executable:

    # Inside a repo you can do
    commi --copy
    # or run it from everywhere and pass the repo path as an argument
    commi --repo "/path/to/your/repo" --commit
    

Using pip

You can install Commi using pip:

    pip install commi

Run the executable:

# Inside a repo you can do
commi --generate
# or run it from everywhere and pass the repo path as an argument
commi --repo "/path/to/your/repo" --generate

Install the binary

You can also download the pre-built binary for your system from the releases page.

Now you're ready to use Commi!

Usage

After installation, you can use the command-line interface (CLI) to generate commit messages.

Basic Usage

To generate a commit message based on the latest changes in your repository:

commi --repo "/path/to/your/repo"

Use Staged Changes

If you want to generate a commit message based on the staged changes:

commi --repo "/path/to/your/repo" --cached

Set an API Key

You can provide your API key directly via the --api-key option:

commi --repo "/path/to/your/repo" --api-key "your_api_key"

Alternatively, you can set the API key as an environment variable:

export API_KEY="your_api_key"
commi --repo "/path/to/your/repo"

If no API key is provided, a default API key will be used.

Copy the Commit Message to Clipboard

To copy the generated commit message to your clipboard, use the --copy flag:

commi --repo "/path/to/your/repo" --copy

This requires the installation of xclip (on Linux systems). If it's not installed, Commi will attempt to install it automatically.

Regenerate a Commit Message

To regenerate the commit message, you can use the --regenerate flag, which will generate a new commit message based on the latest changes.

commi --repo "/path/to/your/repo" --regenerate

Commit the suggested Commit Message

To commit the generated commit message, use the --commit flag:

commi --repo "/path/to/your/repo" --commit

Configuration

Commi uses a .env file to configure certain settings. You can modify the following settings:

  • API_KEY: Your Gemini AI API key.
  • MODEL_NAME: The AI model to use for commit message generation (e.g., gemini-1.5-flash).

Contributing

We welcome contributions to Commi! If you find a bug or want to suggest a new feature, please open an issue or submit a pull request.

  1. Fork the repository.
  2. Create a new branch for your feature (git checkout -b feature-name).
  3. Commit your changes (git commit -am 'Add new feature').
  4. Push to the branch (git push origin feature-name).
  5. Create a new pull request.

License

Commi is open-source software licensed under the MIT License. See the LICENSE file for more details.

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

commi-2.1.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

commi-2.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file commi-2.1.0.tar.gz.

File metadata

  • Download URL: commi-2.1.0.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-51-generic

File hashes

Hashes for commi-2.1.0.tar.gz
Algorithm Hash digest
SHA256 8ab25b0d084090294df009651747a486c02f97dda54e716c30b7918267327a0b
MD5 f7936e3e41a7cd5d9b030eec91c5ec47
BLAKE2b-256 9e55e40b12591797145ef6e9f37b1d2d625f80a69171d643520cad90b7633d5a

See more details on using hashes here.

File details

Details for the file commi-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: commi-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-51-generic

File hashes

Hashes for commi-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e56340796a701221c68ff576d6431b9344a69dcd1b3dbd1ff58706cb8fac4de7
MD5 5cb71c8a16ccc289e296de7c36b9b6db
BLAKE2b-256 26c52a1d3f743909e26421e2e2fba3c3a90fb3b7b44f0d59dd485b2fadbf696f

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