#commit-message #openai #chatgpt #git #cli

app commitgpt

A CLI tool to generate commit messages using OpenAI's ChatGPT based on staged changes in a Git repository

3 stable releases

2.0.0 Aug 25, 2023
1.0.2 Apr 5, 2023
1.0.1 Apr 4, 2023

#2 in #generate-multiple

Download history 4/week @ 2023-11-04 2/week @ 2023-11-11 2/week @ 2023-11-18 13/week @ 2023-11-25 15/week @ 2023-12-02 1/week @ 2023-12-09 6/week @ 2023-12-16 6/week @ 2023-12-23 3/week @ 2023-12-30 1/week @ 2024-01-06 1/week @ 2024-01-13 1/week @ 2024-01-20 10/week @ 2024-01-27 3/week @ 2024-02-03 16/week @ 2024-02-10 55/week @ 2024-02-17

84 downloads per month

EUPL-1.2

25KB
353 lines

CommitGPT: A ChatGPT-powered Commit Message Generator

This repository contains the source code for CommitGPT, a tool that helps you create commit messages using the OpenAI ChatGPT API. It uses the GPT-4 architecture and provides a simple CLI interface for generating commit messages based on the staged changes in a Git repository.

Features

  • Generate multiple suggestions for commit messages based on staged changes in the repository.
  • Choose from different ChatGPT models.
  • Customize the number of suggestions, tokens, and other options.
  • Interactive selection of the generated commit messages.

Prerequisites

To use CommitGPT, you need:

Installation

  1. Install from crates.io
cargo install commitgpt
  1. Create the configuration file:
mkdir -p ~/.config/commitgpt
touch ~/.config/commitgpt/config.toml
  1. Add your OpenAI API key to the configuration file:
echo 'api_key = "YOUR_OPENAI_API_KEY"' > ~/.config/commitgpt/config.toml

Usage

  1. Stage your changes in a Git repository using git add.
  2. Run CommitGPT to generate commit message suggestions:
commitgpt
  1. Pick a commit message from the generated suggestions, or exit the selection prompt to cancel.
  2. Optionally, edit the commit message and save to complete the commit process.

Customization

You can customize the behavior of CommitGPT using command-line options. For example, to generate 7 commit message suggestions and limit the message length to 300 tokens, run:

commitgpt -s 7 -t 300

For more options, run commitgpt --help.

Contributing

Please feel free to submit issues and pull requests on GitLab: https://gitlab.com/kerkmann/commitgpt

Trademarks

I am not affiliated, associated, authorized, endorsed by, or in any way officially connected with OpenAi, ChatGPT and the OpenAi are trademarks or registered trademarks of OpenAi in San Francisco, CA and/or other countries.

License

Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission - subsequent versions of the EUPL (the "Licence");
You may not use this work except in compliance with the Licence.
You may obtain a copy of the Licence at:

https://joinup.ec.europa.eu/software/page/eupl

Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the Licence for the specific language governing permissions and limitations under the Licence.

Dependencies

~15–30MB
~469K SLoC