git-smart-commit is a lightweight, open-source AI-powered CLI tool written in Go. It automatically analyzes your staged Git changes using Google Gemini AI (gemini-3.5-flash) and generates structured, high-quality Conventional Commit messages with optional one-click remote push.
- 🤖 AI Staged Diff Analysis: Analyzes your complete
git diff --cachedcontext rather than isolated files to determine the true primary purpose of your changes. - 📜 Conventional Commits Compliance: Strictly formats commits following standard types (
feat,fix,docs,refactor,perf,test,chore, etc.), concise scopes, and max 72-character subjects. - 🖥️ Interactive Terminal UI: Powered by
charmbracelet/huhfor smooth, interactive prompts and confirmation screens. - 🚀 Streamlined Git Workflow: Preview AI-generated suggestions, confirm execution, and optionally push to your active branch in a single command.
- 🛡️ Built-in Safety: Validates Git repository status, verifies staged changes, and validates API keys before execution.
You need a Google Gemini API Key. Get one for free at Google AI Studio.
Set your API key in your terminal environment:
- Linux / macOS:
export GEMINI_API_KEY="your_gemini_api_key_here"
- Windows (PowerShell):
$env:GEMINI_API_KEY="your_gemini_api_key_here"
- Windows (CMD):
set GEMINI_API_KEY=your_gemini_api_key_here
go install github.com/IchwanArdi/git-smart-commit@latestDownload the pre-compiled binary for your operating system from the Releases Page.
# Clone the repository
git clone https://github.com/IchwanArdi/git-smart-commit.git
cd git-smart-commit
# Build binary
go build -o git-smart main.go-
Stage your changed files with Git:
git add . -
Run
git-smart(or./git-smart-commit):git-smart
-
git-smart-commit will:
- Analyze your staged diff with Gemini AI.
- Display the formatted Conventional Commit message (
type(scope): subject). - Prompt for interactive confirmation to create the commit.
- Optionally ask to push changes to your current remote branch.
- Language: Go 1.26
- AI Model: Google Gemini API (
google.golang.org/genai) - CLI Framework: Cobra (
github.com/spf13/cobra) - TUI & Prompts: Huh (
github.com/charmbracelet/huh)
Contributions are warmly welcomed! As an open-source project, community involvement helps make git-smart-commit even better.
- Fork the repository.
- Create your feature branch:
git checkout -b feature/amazing-feature
- Commit your changes (preferably using
git-smart-commit!):git-smart
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request and describe your changes.
If you encounter any bugs or have feature suggestions, feel free to open an issue on the Issues page.
Distributed under the MIT License. See LICENSE for more information.
