gemini-git-helper
is a command line tool designed to assist with git commits by providing AI-generated commit messages. It can also amend existing commits, concatenating the new commit message to the existing one.
- Generate commit messages using AI.
- Support for both standard commits and amended commits.
- Interactive prompts to guide the user through the commit process.
- Clear user feedback on the status of commit operations.
Install the package globally using npm:
npm install -g gemini-git-helper
Create a .env
file in your working directory and add your Google Generative AI API key:
API_KEY=your_google_generative_ai_api_key
Alternatively, you can export the API key as an environment variable:
export API_KEY=your_google_generative_ai_api_key
To obtain an api key, go to Google AI For Developers
To perform a standard commit:
gemini-git commit
To amend the last commit:
gemini-git commit --amend
When you run the commit
command, you will be prompted to choose whether to generate a commit message using AI:
Do you want to generate a commit message using AI? (yes/no)
- If you choose
y
, the tool will generate a commit message based on the staged changes and open the commit editor with the generated message. - If you choose
n
, the commit editor will open without a pre-generated commit message.
-
Stage Your Changes:
git add .
-
Run the Commit Helper:
gemini-git commit
-
Follow the Prompts:
Respond to the prompt about using AI to generate the commit message.
-
Review and Edit the Commit Message:
The commit editor will open with the generated or empty commit message. Edit if necessary and save to complete the commit.
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License.
By following the above instructions, you can leverage gemini-git-helper
to streamline your commit process with AI-generated messages, making your commit history clearer and more informative.