Git AI Commit is a powerful CLI tool that leverages local AI models (via Ollama) to automatically generate meaningful commit messages and push your changes with a single command. Perfect for developers who want to maintain clean commit history without the manual effort.
- ✨ AI-Powered Commit Messages - Context-aware commit messages generated from your code changes
- 🔒 100% Local Processing - Your code never leaves your machine
- ⚡️ Single-Command Workflow - Stage, commit, and push with one command
- 🤖 Multi-Model Support - Works with any Ollama-compatible model (Mistral, Llama 3, CodeLlama, etc.)
- 📝 Conventional Commits - Follows industry-standard commit conventions
- 🛡️ Secure - Uses your existing Git credentials
- Install Go (v1.16+)
- Install Ollama
- Download a language model:
ollama pull mistral # Recommended model
# Clone the repository
git clone https://github.com/yourusername/git-ai-commit.git
cd git-ai-commit
# Build and install
go build -o git-ai-commit
sudo mv git-ai-commit /usr/local/bin/
# Stage your changes
git add .
# Generate commit message and push
git-ai-commit
# Use a specific model
git-ai-commit --model llama3
# See help
git-ai-commit --help
$ git add .
$ git-ai-commit
Generated commit message:
feat: implement auto-commit functionality using Ollama API
Successfully committed and pushed changes!
Customize the behavior by modifying these elements in the code:
-
Prompt Engineering - Modify the prompt template in
generateCommitMessage()
:prompt := fmt.Sprintf(`Generate a concise git commit message...`)
-
Commit Message Cleaning - Adjust the cleaning logic in
cleanCommitMessage()
:func cleanCommitMessage(msg string) string { // Your custom cleaning logic }
-
Commit Rules - Add validation checks before committing
Any Ollama-compatible model can be used:
mistral
(default)llama3
codellama
phi3
gemma
Find more models at Ollama Library
A: No! All processing happens locally using your Ollama installation. Your code never leaves your machine.
A: Currently the tool commits and pushes automatically. You can modify the code to remove the push step if you prefer manual pushing.
A: Absolutely! The tool uses your existing Git credentials and works with any repository you have access to.
sudo rm /usr/local/bin/git-ai-commit
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a pull request
MIT License - see LICENSE for details.
Git AI Commit - Never write a commit message again! ✨🤖💾