Skip to content

A CLI tool to generate insightful commit messages and issues with GPT model.

License

Notifications You must be signed in to change notification settings

ShinChven/git-gpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git-GPT

A CLI tool to auto-generate git commit messages and issues using OpenAI's GPT model.

generate-commit-message

Installation

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

Development

python -m venv venv
source venv/bin/activate
pip install -e .

Configuration

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>

Options:

  • --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.

Usage

Generating Commit Messages

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.

Creating Issues

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.

Performing a Quality Check

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.

Generating a Changelog

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.

Asking a Custom Question

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.

Trouble Shooting

aiohttp

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

Disclaimer

  • Content generated by this tool is not guaranteed to be correct. You should always review and edit the generated content before committing.

Contributing

Feel free to fork the repository, create a feature branch, and open a Pull Request.

License

MIT License

About

A CLI tool to generate insightful commit messages and issues with GPT model.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages