A CLI tool to auto-generate git commit messages and issues using OpenAI's GPT model.
Install git-gpt
via pip:
pip install git+https://github.com/ShinChven/git-gpt.git#egg=git-gpt
Upgrade:
pip install --upgrade git+https://github.com/ShinChven/git-gpt.git#egg=git-gpt
python -m venv venv
source venv/bin/activate
pip install -e .
Before using git-gpt
, you'll need to configure it with your OpenAI API key and other optional settings. Run the following command and follow the prompts:
git-gpt config --api-key <API_KEY>
--api-key
: The API key to use with OpenAI.--base
: The alternative OpenAI host.--model
: The model to use for generating messages.--lang
: Target language for the generated message (default is 'en').--issue-max-tokens
: The maximum number of tokens to use for the issue prompt.--changelog-max-tokens
: The maximum number of tokens to use for the changelog prompt.--quality-check-max-tokens
: The maximum number of tokens to use for the quality check command.
Stage all changes and generate a commit message using GPT model:
git-gpt commit [--lang <LANGUAGE>] [--model <GPT-MODEL>] [--run-dry]
Options:
--lang
: Target language for the generated message (default is 'en').--model
: The model to use for generating messages (default is 'gpt-3.5-turbo').--run-dry
: Print the generated message without committing.
To create an issue based on the diffs of the latest commit(s), run:
git-gpt issue [--lang <LANGUAGE>] [--model <GPT-MODEL>] [--max-tokens <MAX_TOKENS>] [--commit-range <COMMIT_RANGE>]
Options:
--lang
: Target language for the generated message (default is 'en').--model
: The model to use for generating messages (default is 'gpt-3.5-turbo').--max-tokens
: The maximum number of tokens to use for the issue prompt.--commit-range
: The range of commits to consider for generating the issue.
To perform a quality check on the diffs of the latest commit(s), run:
git-gpt quality [--lang <LANGUAGE>] [--model <GPT-MODEL>] [--max-tokens <MAX_TOKENS>] [--commit-range <COMMIT_RANGE>]
Options:
--lang
: Target language for the generated message (default is 'en').--model
: The model to use for generating messages (default is 'gpt-3.5-turbo').--max-tokens
: The maximum number of tokens to use for the issue prompt.--commit-range
: The range of commits to consider for generating the issue.
To generate a changelog based on the diffs of the latest commit(s), run:
git-gpt changelog [--lang <LANGUAGE>] [--model <GPT-MODEL>] [--max-tokens <MAX_TOKENS>] [--commit-range <COMMIT_RANGE>]
Options:
--lang
: Target language for the generated changelog (default is 'en').--model
: The model to use for generating the changelog (default is 'gpt-3.5-turbo').--max-tokens
: The maximum number of tokens to use for the changelog prompt.--commit-range
: The range of commits to consider for generating the changelog.
To ask a custom question about the code diffs, run:
git-gpt ask --question <YOUR_QUESTION> [--model <GPT-MODEL>] [--commit-range <COMMIT_RANGE>]
Options:
--question
: The question to ask about the code diffs.--model
: The model to use for generating the response (default is 'gpt-3.5-turbo').--commit-range
: The range of commits to consider when forming the response.
If you encounter any issues concerning aiohttp
, please try to downgrade python to 3.11, as this issue is reported with python 3.12:
ERROR: Could not build wheels for aiohttp, which is required to install pyproject.toml-based projects
- Content generated by this tool is not guaranteed to be correct. You should always review and edit the generated content before committing.
Feel free to fork the repository, create a feature branch, and open a Pull Request.