Skip to content

LLM-powered Git commit message generator using Ollama models.

Notifications You must be signed in to change notification settings

umutkavakli/gcm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gcm - Git Commit Message Generator

gcm is a lightweight function that automatically generates commit messages using an LLM models with ollama. It provides an interactive prompt to accept, edit, regenerate, or cancel the commit message. You can also specify a different model for message generation. Inspired by Andrej Karpathy's gist snippet.

📥 Installation

1. Install Ollama

gcm requires Ollama to generate commit messages. Install it by following the instructions on the official website:

curl -fsSL https://ollama.ai/install.sh | sh

2. Install gcm

Run the following script to install gcm:

# Clone the repository
git clone https://github.com/umutkavakli/gcm.git
cd gcm

# Run the install script
chmod +x install.sh
./install.sh

This will:

  • Copy required files to /usr/local/share/gcm/
  • Set up an alias in ~/.bashrc for easy access

📌 Usage

Basic Commit Message Generation

Simply stage your changes and run:

gcm

This will:

  1. Generate a commit message based on staged changes
  2. Show an interactive prompt with options:
    • (a)ccept: Use the generated commit message
    • (e)dit: Enter a custom message
    • (r)egenerate: Generate a new message
    • (c)ancel: Exit without committing

Using a Custom Model

To use a different model for commit message generation:

gcm -m model_name

This will:

  • Update Modelfile to use the specified model
  • Recreate the AI model with ollama create

Help Command

To see available options, run:

gcm -h

🛠️ Troubleshooting

1. gcm: command not found?
Ensure that your shell is sourcing the alias. Run:

source ~/.bashrc

2. AI model fails to generate messages?
Check if ollama is installed and working properly:

ollama list

About

LLM-powered Git commit message generator using Ollama models.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages