A CLI that writes your git commit messages for you with AI. Never write a commit message again.
$ gem install commitgpt
Grab your OpenAI key and add it as an env variable.
$ export OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx
It's recommended to add the first line to your
.bashrc so it persists instead of having to define it in each terminal session.
aicm is an abbreviation for
AI commits, after
git add . add your file to stage, then use
aicm to commit with an AI generated commit message.
$ cd /path/to/your/repo $ git add . $ aicm ▲ Welcome to AI Commits! ▲ Generating your AI commit message... ▲ Commit message: git commit -am "Update README.md with contribution instructions and OpenAI API key instructions." ▲ Do you want to commit this message? [y/n] [main c082637] Update README.md with contribution instructions and OpenAI API key instructions. 4 files changed, 24 insertions(+), 19 deletions(-)
The latest version of the gem is
0.1.2. To update, run the following commands:
$ gem update commitgpt $ gem cleanup commitgpt $ gem info commitgpt
I used ChatGPT to convert
AICommits from TypeScript to Ruby. Special thanks to https://github.com/Nutlope/aicommits
How it works
This CLI tool runs a git diff command to grab all the latest changes, sends this to OpenAI's GPT-3, then returns the AI generated commit message. I also want to note that it does cost money since GPT-3 generations aren't free. However, OpenAI gives folks $18 of free credits and commit message generations are cheap so it should be free for a long time.
Only supports git diffs of up to 200 lines of code for now
The generated commit message can't be edited yet, but you can choose
n and copy the commit command and edit it manually.
Bug reports and pull requests are welcome on GitHub at https://github.com/ZPVIP/commitgpt. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the CommitGpt project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.