This is a Ruby gem that automates the process of generating Git commit messages using AI.
Fun Fact: Every commit in this project (except the very first one) was generated using the AI-powered commit message generator in this code!
- This gem uses OpenAI's GPT-4o Mini model, which is cost-effective but requires an internet connection and an API key. Currently, the model is hardcoded.
- It has no dependencies, making it easy to install and integrate into projects without conflicts.
gem install autogitc
Make sure to set your OpenAI API key in the environment variable AUTOGITC_KEY
.
-
Add some files to your Git repository:
git add .
-
Trigger the autogitc process using:
autogitc
This will analyze your changes and generate an AI-powered commit message. It will be committed with the generated message.
- Use
--nc
(or--nocommit
) to get the generated commit message without making a commit. - Use
--text=XXX
to specify a required text that should be included in the generated commit message. ReplaceXXX
with your desired text.
The PR template generator will create a template for your pull request.
$ bundle exec autogitc pr
- Specify the base branch using
--base=BRANCH_NAME
(default ismain
if not specified). - The generator will search for the template file in the following locations (in order):
/project/pull_request_template.md
/project/docs/pull_request_template.md
/project/.github/pull_request_template.md
Bug reports and pull requests are welcome on GitHub at https://github.com/adriangohjw/autogitc.
The gem is available as open source under the terms of the MIT License.