commit-msg
is a command-line tool that generates commit messages using LLM (Large Language Models). It is designed to help developers create clear and concise commit messages for their Git repositories automatically by analyzing your staged changes.
Below is a sample execution of commit-msg
:
This project is participating in Hacktoberfest 2025! We welcome contributions from developers of all skill levels.
Looking to contribute? Check out:
β¨ AI-Powered Commit Messages - Automatically generate meaningful commit messages
π Multiple LLM Support - Choose between Google Gemini, Grok, Claude, ChatGPT, or Ollama (local)
π Context-Aware - Analyzes staged and unstaged changes
π Auto-Copy to Clipboard - Generated messages are automatically copied for instant use
ποΈ Interactive Review Flow - Accept, regenerate with new styles, or open the message in your editor before committing
π File Statistics Display - Visual preview of changed files and line counts
π Easy to Use - Simple CLI interface with beautiful terminal UI
β‘ Fast - Quick generation of commit messages
You can use Google Gemini, Grok, Claude, ChatGPT, or Ollama (local) as the LLM to generate commit messages:
-
Download the latest release from the GitHub Releases page
-
Extract the executable to a directory
-
Add the directory to your system PATH:
Windows:
setx PATH "%PATH%;C:\path\to\commit-msg"
Linux/macOS:
export PATH=$PATH:/path/to/commit-msg echo 'export PATH=$PATH:/path/to/commit-msg' >> ~/.bashrc # or ~/.zshrc
Requirements: Go 1.23.4 or higher
# Clone the repository
git clone https://github.com/dfanso/commit-msg.git
cd commit-msg
# Install dependencies
go mod download
# Build the executable
go build -o commit cmd/commit-msg/main.go
# (Optional) Install to GOPATH
go install
Navigate to any Git repository and run:
commit .
Or if running from source:
go run cmd/commit-msg/main.go .
commit llm setup


commit llm update


# Make changes to your code
echo "console.log('Hello World')" > app.js
# Stage your changes
git add .
# Generate commit message
commit .
# The tool will display:
# - File statistics (staged, unstaged, untracked)
# - Generated commit message in a styled box
# - Automatically copy to clipboard
# Output: "feat: add hello world console log to app.js"
# You can now paste it with Ctrl+V (or Cmd+V on macOS)
Once the commit message is generated, the CLI now offers a quick review loop:
- Accept & copy β use the message as-is (it still lands on your clipboard automatically)
- Regenerate β pick from presets like detailed summaries, casual tone, bug-fix emphasis, or provide custom instructions for the LLM
- Edit in your editor β open the message in
$GIT_EDITOR
,$VISUAL
,$EDITOR
, or a sensible fallback (notepad
on Windows,nano
elsewhere) - Exit β leave without copying anything if the message isn't ready yet
This makes it easy to tweak the tone, iterate on suggestions, or fine-tune the final wording before you commit.
- π Generate commit messages for staged changes
- π Analyze both staged and unstaged changes
- π Get context from recent commits and file statistics
- β Create conventional commit messages
- π Auto-copy to clipboard for immediate use
- π¨ Beautiful terminal UI with file statistics and previews
commit llm setup
commit llm update
Select: Set Default
Select: Change API Key
Select: Delete
Google Gemini:
- Visit Google AI Studio
- Create a new API key
Grok (X.AI):
- Visit X.AI Console
- Generate an API key
Groq:
- Sign up at Groq Cloud
- Create an API key
Claude (Anthropic):
- Visit the Anthropic Console
- Create a new API key
OpenAI (ChatGPT):
- Visit OpenAI Platform
- Create a new API key
Ollama (Local LLM):
- Install Ollama: Visit Ollama.ai and follow installation instructions
- Start Ollama:
ollama serve
- Pull a model:
ollama pull llama3.1
- Set environment variables:
export COMMIT_LLM=ollama export OLLAMA_MODEL=llama3.1 # llama3.1 by default
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes
- Commit your changes:
git commit -m 'feat: add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
- π Bug fixes
- β¨ New LLM provider integrations (OpenAI, Claude, etc.)
- π Documentation improvements
- π§ͺ Test coverage
- π Internationalization
- β‘ Performance optimizations
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to all contributors
- Google Gemini and X.AI Grok for providing LLM APIs
- The open-source community
- π Report a Bug
- π‘ Request a Feature
- π¬ Ask a Question
Made with β€οΈ for Hacktoberfest 2025