| Crates.io | aigitcommit |
| lib.rs | aigitcommit |
| version | 1.3.0 |
| created_at | 2025-03-05 03:23:03.541871+00 |
| updated_at | 2025-03-05 03:23:03.541871+00 |
| description | A simple git commit message generator by OpenAI compaction model. |
| homepage | https://github.com/mingcheng/aigitcommit |
| repository | https://github.com/mingcheng/aigitcommit |
| max_upload_size | |
| id | 1578180 |
| size | 107,150 |

A simple tool to help you write better Git commit messages using AI.
AIGitCommit looks at your Git staged changes and uses AI to make commit lines that are clear and helpful.
It looks at the diff result and uses machine learning to figure out what your changes were meant to do and why you made them. It then generates a commit message that is clear and helpful.
AIGitCommit is still in the early stages of development, I suggest you to install it using the git URL using the commands below:
cargo install --git https://github.com/mingcheng/aigitcommit.git
This command will auto-download the latest version of the project and install it to your cargo bin directory.
Initially, you must configure your OPENAI_* environment variables to request prompts from an OpenAI-compatible API service. Set them as follows in your shell configuration file:
OPENAI_API_TOKEN: Your individual OpenAI tokenOPENAI_API_BASE: Your specified openAI request baseOPENAI_MODEL_NAME: Give the model name you wish to requestIf your network requirements a proxy to access the API service, you must specify the proxy address using the OPENAI_API_PROXY environment variable.
For instance, http://127.0.0.1:1080 is suitable for an HTTP proxy, while socks://127.0.0.1:1086 is an appropriate choice for a Socks5 proxy.
The way to use AIGitComment is really simple. For example, you can run aigitcoment in the current directory after staging the file to have git commits generated automatically before git commit. Additionally, you may provide the git directory using aigitcommit <dir>.
--commit parameters to commit the changes straight to the repository.--copy.If you would like more usage settings, just use aigitcommit --help to get more details.
The AIGitCommit also supports git hooks. To integrate the hook, simply copy the hooks/prepare-commit-msg file into the repository's .git/hooks/prepare-commit-msg, and you're done.
You can make it global by using Git's core.hooksPath instead of setting it up per repository.
# Create global hooks directory
mkdir -p ~/.git-hooks
# Copy the script contents above into this file
vim ~/.git-hooks/prepare-commit-msg # Or use your preferred editor
# Make the script executable
chmod +x ~/.git-hooks/prepare-commit-msg
# Configure Git to use global hooks
git config --global core.hooksPath ~/.git-hooks
Now every repository automatically gets AIGitCommit commit messages, just use git commit command.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- eof -