https://github.com/puneetkakkar/gpt-commit
A developer-friendly CLI tool that generates smart Git commit messages from your code changes using GPT models (OpenAI) or local LLMs like CodeLlama via Ollama.
https://github.com/puneetkakkar/gpt-commit
ai-tools automation cli commit-messages developer-tools git gpt llm ollama openai
Last synced: about 1 month ago
JSON representation
A developer-friendly CLI tool that generates smart Git commit messages from your code changes using GPT models (OpenAI) or local LLMs like CodeLlama via Ollama.
- Host: GitHub
- URL: https://github.com/puneetkakkar/gpt-commit
- Owner: puneetkakkar
- License: mit
- Created: 2025-06-06T20:05:43.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-06-06T23:18:00.000Z (12 months ago)
- Last Synced: 2025-07-03T05:36:50.816Z (11 months ago)
- Topics: ai-tools, automation, cli, commit-messages, developer-tools, git, gpt, llm, ollama, openai
- Language: Python
- Homepage:
- Size: 257 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
gpt-commit
🚀 Automatically generate Git commit messages using GPT (OpenAI) or local models via Ollama.
## ✨ Features
- Uses `git diff --cached` to summarize staged changes
- Works with OpenAI GPT models (gpt-3.5-turbo, gpt-4)
- Supports local LLMs via [Ollama](https://ollama.com/)
- CLI tool: simple, fast, dev-friendly
## 📦 Installation
### From PyPI
```bash
pip install gpt-commit
```
### From Source
```bash
git clone https://github.com/yourusername/gpt-commit.git
cd gpt-commit
pip install -e .
```
## 🔧 Setup
### OpenAI Backend
1. Get your API key from [OpenAI](https://platform.openai.com/api-keys)
2. Set the environment variable:
```bash
export OPENAI_API_KEY='your-api-key'
```
Or create a `.env` file in your project root:
```
OPENAI_API_KEY=your-api-key
```
### Ollama Backend
1. Install [Ollama](https://ollama.com/)
2. Pull a model (e.g., CodeLlama):
```bash
ollama pull codellama
```
## 🚀 Usage
1. Stage your changes:
```bash
git add .
```
2. Generate a commit message:
```bash
# Using OpenAI (default)
gpt-commit --backend openai --model gpt-4
# Using Ollama
gpt-commit --backend ollama --model codellama
# Auto-commit with the generated message
gpt-commit --commit
```
## 🔍 Options
- `--backend`: Choose between 'openai' or 'ollama' (default: 'ollama')
- `--model`: Specify the model name (default: 'gpt-4' for OpenAI, 'codellama' for Ollama)
- `--commit`: Automatically commit with the generated message
## 🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## 📝 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.