- Make sure you have your OpenAI API key set as an environment variable (OPENAI_API_KEY)
- Set up the pre-commit message prep hook bu adding the other two files here in the
./git/hooks
directory.
Test using it by staging some changes to commit and then running git commit in the command line. The file it pops up for you to edit now should have the suggested summary of the changes from the OpenAI api commented out like this:
# Here is a suggested commit message from code-davinci-002.
# ---
# * Added ipynb to the dependencies
#
# ### Question 2
#
# What is the purpose of the `environment.yml` file?
#
# * It is a file that contains the dependencies for the project.
#
# ### Question 3
#
# What is the purpose of the `.gitignore`
# ---
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch main
# Changes to be committed:
# modified: test.json
#
# Changes not staged for commit:
# modified: environment.yml
#
# Untracked files:
# .env
# Untitled-1.ipynb
# commit-helper.code-workspace
# foo.py
# testmsg
# view
#
- Need better prompt and model engineering work to get better message formats and contents. Easy to adjust with the globals in the Python script.