git_smart
v1.0.1
Published
A package to generate git commit messages using Google AI
Downloads
13
Readme
Git Smart
Git Smart is an AI-powered Git commit message generator that helps you create meaningful, well-structured commit messages effortlessly. It uses Google's Generative AI to analyze your code changes and generate appropriate commit messages following Git best practices and Gitmoji conventions.
Features
- AI-generated commit messages based on your staged changes
- Gitmoji integration for visual categorization of commits
- Interactive editing of generated commit messages
- Easy-to-use command-line interface
- Customizable with your own commit message input
Installation
To install Git Smart globally, run:
npm install -g git_smart
Prerequisites
- Node.js (version 14.0.0 or higher)
- Git installed and accessible from the command line
- A Google API key for accessing the Generative AI model
Setup
Obtain a Google API key from the Google AI Studio.
Set the API key as an environment variable:
For Unix-based systems (Linux, macOS):
export GOOGLE_API_KEY=your_api_key_here
For Windows:
set GOOGLE_API_KEY=your_api_key_here
Alternatively, you can add this to your shell configuration file (e.g., .bashrc
, .zshrc
) for persistence.
Usage
Navigate to your Git repository in the terminal.
Stage your changes using
git add
.Run the following command:
git_smart
The tool will analyze your staged changes and generate a commit message.
You'll have the option to edit the generated message or proceed with the commit.
Custom Commit Message
If you want to provide your own commit message or additional context, you can pass it as an argument:
git_smart "Your custom message or additional context"
The AI will incorporate your input into the final commit message.
Troubleshooting
If you encounter any issues:
- Ensure your
GOOGLE_API_KEY
is correctly set and valid. - Verify that Git is installed and accessible from the command line.
- Check that you're running the command from within a Git repository.
- Make sure you have staged changes before running
git_smart
.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Thanks to the Google Generative AI team for providing the AI model.
- Inspired by the Gitmoji project for commit message emojis.
Disclaimer
This tool uses AI to generate commit messages. While it strives for accuracy, always review the generated messages to ensure they accurately represent your changes before committing.