A Go-based tool that generates intelligent commit messages using Ollama's deepseek-r1:8b model by analyzing git diffs.
- 🤖 Uses local Ollama service with
deepseek-r1:8bmodel - 📝 Generates commit messages based on actual code changes
- 🎯 Limits commit messages to maximum 20 words
- 🚀 Simple command: just run
gencommit - 🔍 Automatically detects staged and unstaged changes
- Go 1.22+ installed on your system
- Ollama running locally with
deepseek-r1:8bmodel downloaded - Git repository initialized
make installmake install-localNote: If using install-local, ensure ~/.local/bin is in your PATH:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc# Build the binary
go build -o gencommit main.go
# Move to a directory in your PATH
sudo cp gencommit /usr/local/bin/
# OR
cp gencommit ~/.local/bin/-
Navigate to a git repository
cd /path/to/your/git/repo -
Make some changes to your code
-
Stage your changes (optional)
git add . -
Generate a commit message
gencommit
-
Commit with the generated message
git commit -m "your generated message here"
- The tool checks if you're in a git repository
- It analyzes the git diff (staged changes first, then unstaged)
- Sends the diff to your local Ollama service using the
deepseek-r1:8bmodel - Generates a concise commit message (max 20 words)
- Displays the message and provides the git commit command
The tool connects to Ollama at http://localhost:11434 by default. If you need to change this, modify the URL in the generateCommitMessage function in main.go.
- Ensure you're in a directory with a
.gitfolder - Run
git initif you haven't initialized the repository
- Make sure Ollama is running:
ollama serve - Verify the
deepseek-r1:8bmodel is downloaded:ollama list - Check if Ollama is accessible at
http://localhost:11434
- Stage your changes with
git add .or make new changes - The tool checks both staged and unstaged changes
# Get dependencies
make deps
# Build locally
make build
# Test locally
make run
# Clean build artifacts
make cleanThis project is open source and available under the MIT License.