Project

commitgpt

0.02
No release in over a year
A CLI that writes your git commit messages for you with AI. Never write a commit message again.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.18
~> 1.2
 Project Readme

Commit GPT

A CLI that writes your git commit messages for you with AI. Never write a commit message again.


Installation

$ gem install commitgpt

Usage

API key

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 .zshrc or .bashrc so it persists instead of having to define it in each terminal session.

aicm

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(-)

Update

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

Special Thanks

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.

Limitations

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.

Contributing

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.

License

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.