Powered by Ollama

AI-Powered Git Commit Messages

Generate concise, relevant commit messages for your Git repositories using local AI models with Ollama. Streamline your workflow and let AI handle the first draft of your commit messages!

npm version License: MIT
Git AI Commit Demo

Installation

Get Started

Up and running in minutes

$ npm install -g @chris_glolabs/git-ai-commit

The installation process automatically sets up a global Git alias: git aic which executes git-ai-commit.

Prerequisites

1

Git

Make sure Git is installed on your system. Download Git

2

Node.js

Version 16 or higher recommended. Download Node.js

3

Ollama

Needs to be installed and running. Download Ollama

Important: Make sure the Ollama server is running before using git-ai-commit. You can typically start it by running ollama serve in your terminal.

Ensure you have pulled at least one model (e.g., ollama pull llama3:8b).

Usage

Start generating AI-powered commit messages

Getting Started

1

Stage your changes

Make your code changes and stage them using git add.

$ git add .
2

Generate the commit message

Run the git aic command.

$ git aic
3

Review and Confirm

The tool will connect to your running Ollama instance, analyze the staged diff, and generate a commit message.

Generating commit message...

Generated commit message:

Updated demo images, adjusted layout padding and margins for better UX.

? Do you want to use this commit message? (Y/n)

Enter or y + Enter Accept and commit
n + Enter Abort the commit

Features

Discover what makes Git AI Commit a powerful tool for your development workflow

AI-Powered Commits

Leverages local LLMs through Ollama for intelligent message generation based on your code changes.

Local First

Keep your code private. No data is sent to external servers (besides your local Ollama instance).

Simple Workflow

Integrates seamlessly with your Git process via a handy alias (git aic).

Configurable

Choose your preferred Ollama model, set timeouts, customize prompts, and decide whether to auto-accept suggestions.

Automatic Setup

Installs a convenient git aic alias during setup for quick access.

Interactive Confirmation

Review and confirm the generated message before committing (configurable).

Configuration

Customize

Tailor to fit your workflow

You can customize git-ai-commit's behavior using the config command:

$ git aic config
# or directly via
$ git-ai-commit config
Configuration Demo

Configuration Options

Model Selection

Choose which Ollama model to use (e.g., llama3:8b, mistral). It attempts to list models available locally if Ollama is running.

Always Accept

Set to true to skip the confirmation step and automatically use the generated commit message. Defaults to false.

Timeout

Set the timeout (in seconds) for requests to the Ollama API. Increase this if you use larger models or have slower hardware.

Custom Prompt

Allows you to provide your own prompt template for generating commit messages.

Troubleshooting

Common issues and their solutions

Error: Ollama is not installed

Make sure you have installed Ollama correctly. See Prerequisites.

Error: Ollama is not running

Start the Ollama server, usually by running ollama serve in your terminal.

Error: Request timed out

  • Your selected model might be too large for your system or the changes are too complex.
  • Try configuring a smaller model (e.g., llama3:8b instead of llama3:70b).
  • Increase the timeout using git-ai-commit config.

Error: Failed to fetch models

This might happen if Ollama isn't running or accessible when you run git-ai-commit config. You can still manually type the name of a model you know you have installed.

Ready to streamline your Git workflow?

Start using Git AI Commit today and let AI create better commit messages!