Better Commit is a Dart package that uses AI to generate meaningful commit messages based on your code changes.
❌ Before 🤮
git commit -m "update version"
✅ After 😎
git commit -m "🚀 [RELEASE] Update version to 1.4.0" -m "Update version number in pubspec.yaml and changelog."
To install Better Commit globally, run the following command:
dart pub global activate better_commit
Using the Google AI Dart SDK requires an API key. Follow the instructions at https://ai.google.dev/tutorials/setup to create one.
Set your API key as an environment variable:
export GOOGLE_API_KEY="your_api_key"
To add this forever you can add it to:
~/.zshrc or ~/.bashrc
set GOOGLE_API_KEY=your_api_key
To add this forever you can add it to:
Environment Variables in System Properties
Now you're ready to use Better Commit! Simply stage your changes and run:
git add .
better-commit
The AI will analyze your changes and generate a commit message for you.
If you want to provide additional context for the AI, you can use the --custom
flag:
better-commit --custom
This will prompt you to enter an optional commit message, which the AI will consider when generating the final commit message. Using custom flag, You can provide a simple and short message and ai will complete it.
Better Commit uses the Gemini 1.5 Flash model to analyze your staged changes and generate a concise, meaningful commit message. It follows the format:
emoji [TAG] commit message
Enjoy writing better commits with AI assistance!
🤝 Pull Requests Welcome!
We value community contributions and are always looking to improve Better Commit. If you have ideas or improvements, feel free to submit a pull request!
⭐ Show Your Support
If you find Better Commit helpful, consider showing your support:
- Star our GitHub repository to help others discover the project.
- Like the package on pub.dev to boost its visibility in the Dart community.
Your support motivates me to continue updating and enhancing this CLI tool. Every star and like makes a difference!
If you have any questions, suggestions, or just want to connect, feel free to reach out:
-
LinkedIn: linkedin.com/in/hosseinshaya
-
GitHub: github.com/hosseinshaya
-
Banner Designer: linkedin.com/in/mehdishabani98