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:
-
Clone the repository:
git clone https://github.com/Mahmoud-Emad/commi.git cd commi
-
Install the dependencies:
poetry install -
Build the executable:
./build.sh # This aslo will move the excutable to `/usr/local/bin` -
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 COMMI_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:
COMMI_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.
- Fork the repository.
- Create a new branch for your feature (
git checkout -b feature-name). - Commit your changes (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature-name). - Create a new pull request.
License
Commi is open-source software licensed under the MIT License. See the LICENSE file for more details.
Release files for commi 2.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| commi-2.2.5.tar.gz | 7.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| commi-2.2.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.3 kB
Release files / commi-2.2.5.tar.gz
| Download URL | commi-2.2.5.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
43fcb6e9c234345f103d099bf5f5ef389e4ef262b63f4bd7eae4e78bbfacf0df
|
|
BLAKE2b-256 checksum How to use checksums |
40b4b9587a4500e94111cfb859f2e0c9533d7102c5a5b64c95d79746e8c9a51b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-52-generic
|
Release files / commi-2.2.5-py3-none-any.whl
| Download URL | commi-2.2.5-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d7ad022da49c751800a23f446b060a283617eff5a405f8c27d64aa439475e891
|
|
BLAKE2b-256 checksum How to use checksums |
9544de89991384eea31b4e5491e4a82f45801cc01b9b2060aeadf215c767235b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.12.3 Linux/6.8.0-52-generic
|