Original package doesn't work due to config mistake 'package.json'. https://github.com/nooqta/git-commit-gpt
Therefore I fix it and republish as a '@laststance/git-gpt-commit'.
Git Commit GPT-4o
An AI-powered Git extension that generates commit messages using OpenAI's GPT-4o, streamlining the commit process and improving developer productivity.
Installation
There are two ways to install the Git extension: using npm or manual installation.
- Step1: run the following command:
npm install -g @laststance/git-gpt-commit
- Step2: move to any language your project root
cd my-rust-project
- Step3: add
.env
file to .gitignore
echo -e "\n.env" >> .gitignore
git add .
git commit -m 'add .env to .gitignore'
❗️Step3 and 4 must be done for prevent leak your OpenAI API key on Github/GitLab.
- Step5: Get your openai API key from openai and add
.env
file to OPENAI_API_KEY
.
.env
OPENAI_API_KEY=your_openai_api_key
✅ You've completed all setup!
Usage
After setting up the project, you can use the Git extension in any Git repository:
Stage your changes:
git add .
Run the Git extension:
git gpt commit
The script will summarize the Git changes since the last commit and generate a commit message using gpt-4-turbo-preview. You will be prompted to confirm whether to use the suggested message or cancel the commit.
Credits
Thanks to
License
This project is licensed under the MIT License.