Better Commit
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."
Installation
To install Better Commit globally, run the following command:
dart pub global activate better_commit
Getting Started
1. Get an API Key
Using the Google AI Dart SDK requires an API key. Follow the instructions at https://ai.google.dev/tutorials/setup to create one.
2. Set the API Key
Set your API key as an environment variable:
For Linux and MacOS
export GOOGLE_API_KEY="your_api_key"
To add this forever you can add it to:
~/.zshrc or ~/.bashrc
For Windows
set GOOGLE_API_KEY=your_api_key
To add this forever you can add it to:
Environment Variables in System Properties
3. Let the Magic Work
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.
Custom Commit Messages
Suggest a message for AI
If you want to provide additional context for the AI, you can use the -sm "Your suggested message"
.
Or use --suggest-message
flag:
better-commit -sm "You'r suggested message"
better-commit --suggest-message
Force to use your message (just add tag and emoji)
If you wan't to FORCE AI to use your commit message, use -fm "You'r force message"
.
Or use --force-message
flag:
better-commit -fm "You'r force message"
better-commit --force-message
Contributing and Support
🤝 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!
📞 Contact
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