Skip to content

Commit messages with GPT in Emacs

License

Notifications You must be signed in to change notification settings

emacsmirror/gpt-commit

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPT-Commit: Generate Conventional Commit Messages with GPT in Emacs

Screenshot

GPT-Commit is an Emacs package that automatically generates conventional commit messages using the GPT (Generative Pre-trained Transformer) model from OpenAI.

Table of Contents

Installation

Via MELPA

If you have MELPA configured, you can easily install gpt-commit from within Emacs by running:

M-x package-install RET gpt-commit RET

Manual

To install this package manually, clone this repository and add the following to your .emacs or init.el:

(add-to-list 'load-path "/path/to/gpt-commit")
(require 'gpt-commit)

Configuration

  1. Set OpenAI API Key: You will need an API key from OpenAI to use the GPT model. Set the key like this:
(setq gpt-commit-openai-key "YOUR_OPENAI_API_KEY")
  1. Set GPT Model Name (Optional): By default, it uses the gpt-3.5-turbo model. If you wish to use a different model, you can set it like this:
(setq gpt-commit-model-name "YOUR_PREFERRED_MODEL_NAME")
  1. Add Hook: Add the gpt-commit-message function to the git-commit-setup-hook to automatically generate commit messages when the commit message editor starts:
(require 'gpt-commit)
(add-hook 'git-commit-setup-hook 'gpt-commit-message)

Usage

Once you have configured gpt-commit, it will automatically generate a commit message using the GPT model whenever you perform a Git commit. You can accept the message by saving and closing the editor, or you can modify the message as needed.

Please note that using the OpenAI API might incur costs, and there might be usage limitations. Be aware of the OpenAI pricing and policy before extensive use.

License

GPT-Commit is licensed under the GNU General Public License v3.0.

Releases

No releases published

Packages

No packages published

Languages

  • Emacs Lisp 93.1%
  • Makefile 6.9%