A CLI that writes your git commit messages for you with AI. Never write a commit message again.
The easiest way to install and keep CommitGPT updated.
Install:
brew tap ZPVIP/commitgpt https://github.com/ZPVIP/commitgpt
brew install commitgptUpgrade:
brew update
brew upgrade commitgptUninstall:
brew uninstall commitgpt
# Optional: Remove configuration files manually
rm -rf ~/.config/commitgptClick to expand RubyGems installation instructions
If you don't have Ruby installed, follow these steps first.
macOS
1. Install Homebrew (skip if already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc2. Install Ruby dependencies
brew install openssl@3 libyaml gmp rustUbuntu / Debian
Install Ruby dependencies
sudo apt-get update
sudo apt install build-essential rustc libssl-dev libyaml-dev zlib1g-dev libgmp-devInstall Ruby with Mise (version manager)
# Install Mise
curl https://mise.run | sh
# For zsh (macOS default)
echo 'eval "$(~/.local/bin/mise activate)"' >> ~/.zshrc
source ~/.zshrc
# For bash (Ubuntu default)
# echo 'eval "$(~/.local/bin/mise activate)"' >> ~/.bashrc
# source ~/.bashrc
# Install Ruby
mise use --global ruby@3
# Verify installation
ruby --version
#=> 3.4.7
# Update RubyGems
gem update --systemgem install commitgptCommitGPT uses a YAML configuration system (~/.config/commitgpt/) to support multiple providers and per-provider settings.
Run the setup wizard to configure your provider:
$ aicm setupYou'll be guided to:
- Choose an AI provider (Presets: Cerebras, OpenAI, Ollama, Groq, etc.)
- Enter your API Key (stored securely in
config.local.yml) - Select a model interactively
- Set maximum diff length
Note: Please add ~/.config/commitgpt/config.local.yml to your .gitignore if you are syncing your home directory, as it contains your API keys.
Stage your changes and run aicm:
$ git add .
$ aicmSwitch between configured providers easily:
$ aicm -p
# or
$ aicm --providerInteractively list and select a model for your current provider:
$ aicm -m
# or
$ aicm --modelsSelect your preferred commit message format:
$ aicm -f
# or
$ aicm --formatCommitGPT supports three commit message formats:
- Simple - Concise commit message (default)
- Conventional - Follow Conventional Commits specification
- Gitmoji - Use Gitmoji emoji standard
Your selection will be saved in ~/.config/commitgpt/config.yml and used for all future commits until changed.
Simple:
Add user authentication feature
Conventional:
feat: add user authentication feature
fix: resolve login timeout issue
docs: update API documentation
Gitmoji:
β¨ add user authentication feature
π resolve login timeout issue
π update API documentation
View your current configuration (Provider, Model, Format, Base URL, Diff Len):
$ aicm help(Use the help command to see current active provider settings)
Preview the diff that will be sent to the AI:
$ aicm -vTo update to the latest version (if installed via Gem):
$ gem update commitgptWe support any OpenAI-compatible API. Presets available for:
- Cerebras (Fast & Recommended)
- OpenAI (Official)
- Ollama (Local)
- Groq
- DeepSeek
- Anthropic (Claude)
- Google AI (Gemini)
- Mistral
- OpenRouter
- Local setups (LM Studio, LLaMa.cpp, Llamafile)
OpenAI (https://platform.openai.com)
gpt-4o
gpt-4o-mini
Cerebras (https://cloud.cerebras.ai) β Recommended
zai-glm-4.7 # β Best for commit messages - fast & accurate
llama3.1-8b
llama-3.3-70b
Groq (https://console.groq.com)
llama-3.3-70b-versatile
llama-3.1-8b-instant
This CLI tool runs a git diff command to grab all staged changes, sends this to OpenAI's GPT API (or compatible endpoint), and returns an AI-generated commit message. The tool uses the /v1/chat/completions endpoint with optimized prompts/system instructions for generating conventional commit messages.
I used ChatGPT to convert AICommits from TypeScript to Ruby. Special thanks to https://github.com/Nutlope/aicommits
- Ruby >= 2.6.0
- Git
- Clone the repository:
git clone https://github.com/ZPVIP/commitgpt.git cd commitgpt - Install dependencies:
bundle install
To test your changes locally (builds the gem and installs it to your system):
gem build commitgpt.gemspec
gem install ./commitgpt-*.gemTo publish a new version to RubyGems.org (requires RubyGems account permissions):
gem push commitgpt-*.gemWe use a custom script to automate the GitHub Release and Homebrew Formula update process. This enables users to install via brew tap.
Steps:
./scripts/release.sh <version>
# Example: ./scripts/release.sh 0.3.1This script automates:
- Creating and pushing a Git Tag.
- Creating a GitHub Release (which generates the source tarball).
- Calculating the SHA256 checksum of the tarball.
- Updating
Formula/commitgpt.rbwith the new URL and checksum. - Committing and pushing the updated Formula to the repository.
Bug reports and pull requests are welcome on GitHub at https://github.com/ZPVIP/commitgpt. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the CommitGpt project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.