Skip to content

Automate your Git commit messages with AI-powered insights.

License

Notifications You must be signed in to change notification settings

dvershinin/CommitGPT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Commit Message Hook

Description

This git hook automatically generates commit messages based on the changes made to the files in a repository.

Prerequisites

  • jq
  • curl
  • git

Installation Instructions

Clone this repository:

git clone https://github.com/dvershinin/CommitGPT.git ~/.local/share/CommitGPT

Navigate to your project's git hooks directory. It is usually located in:

cd your-project/.git/hooks/

Create a symbolic link to the prepare-commit-msg hook from the cloned repository:

ln -s ~/.local/share/CommitGPT/prepare-commit-msg.sh prepare-commit-msg 
chmod +x prepare-commit-msg 

Configure the necessary environment variable OPENAI_API_KEY in your .bashrc, for example.

Usage

Once installed, the hook will automatically run when you execute git commit in your project repository.

To automatically generate commit messages disregarding any user input (in automated scripts for example, you can use):

GIT_EDITOR=true git commit

Configuring project goal

This step is optional, but it is recommended to configure the project goal in the prepare-commit-msg hook. This will help generate more elaborate reasons as to why the changes introduced by commit was made

Navigate to the Repository:

Change directory into the repository where you want to configure the project goal.

Run the following command to set a custom prompt, for example:

git config commit.goal "assist in automating the process of generating commit messages"

The goal should be a text you would otherwise place while filling int the blanks in the sentence:

The goal of the project is to ...

Verifying the Configuration:

To verify that the configuration has been set correctly, you can use the following command:

git config --get commit.goal

This command will output the currently set goal, allowing you to confirm it’s correctly configured.

About

Automate your Git commit messages with AI-powered insights.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages