gemini-git-helper
v1.0.0
Published
CLI tool to write commit messages using AI
Downloads
2
Readme
gemini-git-helper
Description
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.
Features
- 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.
Installation
Install the package globally using npm:
npm install -g gemini-git-helper
Setup
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
Usage
Standard Commit
To perform a standard commit:
gemini-git commit
Amend Commit
To amend the last commit:
gemini-git commit --amend
Interactive Prompts
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.
Example Workflow
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.
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
License
This project is licensed under the MIT License.
Acknowledgements
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.