Skip to content

Automate commit message creation with a script that fetches Git diffs, sends them to ChatGPT for generating commit messages, and commits with the auto-generated message.

Notifications You must be signed in to change notification settings

k0lo86/GitCommitGPT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

GitCommitGPT

Automate commit message creation with a script that fetches Git diffs, sends them to ChatGPT for generating commit messages, and commits with the auto-generated message.

Installation

  1. Clone this repository:

    git clone https://github.com/your-repo/GitCommitGPT.git
    cd GitCommitGPT
  2. Create a symbolic link to make the script globally accessible:

    sudo ln -s /path/to/GitCommitGPT/gitcommitgpt /usr/bin/gitcommitgpt

    Verify the link:

    ls -l /usr/bin/gitcommitgpt
  3. (Optional) Install clipboard utilities for easier usage:

    • Install wl-clipboard (for Wayland environments):
      sudo apt install wl-clipboard
    • Install xclip (for X11 environments):
      sudo apt install xclip
    • Install xsel (alternative for X11):
      sudo apt install xsel

    These utilities allow the generated commit message to be automatically copied to the clipboard.

Usage

  1. Stage changes in your Git repository:

    git add .
  2. Run the script to generate a commit message:

    gitcommitgpt
  3. The script will:

    • Check for staged changes.
    • Fetch the git diff and generate a meaningful commit message using ChatGPT.
    • Copy the commit message to the clipboard (if wl-clipboard, xclip, or xsel is installed).
  4. Review and commit the changes:

    git commit -m "$(wl-paste)"

    If using xclip:

    git commit -m "$(xclip -o)"

    Or, if using xsel:

    git commit -m "$(xsel --clipboard --output)"

Dependencies

  • Bash
  • Git
  • wl-clipboard (for Wayland environments)
  • xclip or xsel (for X11 environments, optional for clipboard functionality)

About

Automate commit message creation with a script that fetches Git diffs, sends them to ChatGPT for generating commit messages, and commits with the auto-generated message.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages