A simple Rust CLI tool that suggests helpful, AI-generated commit messages based on your current git diff. Built with clap, git2, and OpenAI.
- Analyze staged changes in your Git repo
- Generate clear, concise commit messages
- Fully local CLI usage
This tool reads the git diff from your working directory and sends it to the OpenAI API. The AI then generates commit message suggestions based on the changes.
git clone https://github.com/IbrahimBagalwa/commit_msg_generator.git
cd commit_msg_generatorCreate a .env file with your OpenAI API key:
OPENAI_API_KEY=<your-openai-key>
OPENAI_API_ENDPOINT=<your-openai-endpoint>cargo build --releasesudo cp target/release/commit_msg_generator /usr/local/bin/msg-suggestNow you can use it anywhere with:
msg-suggest --path .- Make changes in your project.
- Stage your files:
git add .- Run the CLI:
cargo run -- --path .Or if installed globally:
msg-suggest --path .Suggested Commit Messages:
1. Add user authentication check in login flow
2. Refactor login handler to improve error handling
3. Update user model with new validation rules
Pick your favorite and commit:
git commit -m "Add user authentication check in login flow"Feel free to contribute to the project by submitting bug reports, feature requests, or even code enhancements. Fork the repository, make your changes, and submit a pull request. Your contributions are highly appreciated.