Skip to content

Lwuisyy/smart-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Smart Commit

AI-powered Git commit message generator

Stop writing boring commit messages. Let AI do it for you.

npm version License: MIT Node.js

Features β€’ Install β€’ Usage β€’ Config β€’ Contributing


✨ Features

  • πŸ” Smart Analysis β€” Reads your git diff and understands what changed
  • πŸ€– Multi-Provider AI β€” Supports OpenAI, Anthropic, Ollama (local/free!), and Gemini
  • πŸ“ Multiple Styles β€” Conventional Commits, Gitmoji, or Simple format
  • 🌍 Multi-Language β€” Generate messages in any language
  • ⚑ Interactive CLI β€” Edit, regenerate, copy, or commit directly
  • πŸš€ Zero Config β€” Works out of the box with sensible defaults
  • πŸ”§ Git Alias Friendly β€” Use sc as a short alias

πŸ“¦ Install

npm install -g smart-commit

Or use without installing:

npx smart-commit

πŸš€ Quick Start

# 1. Configure your AI provider
sc config

# 2. Stage your changes
git add .

# 3. Generate commit message
sc

That's it! Smart Commit analyzes your staged changes and generates a perfect commit message.

Demo

πŸ“– Usage

Basic Usage

# Generate from staged changes
sc

# Stage all changes and generate
sc --all
# or
sc -a

# Commit directly without confirmation
sc --yes
# or
sc -y

# Only copy message to clipboard
sc --copy

Configuration

# Interactive setup
sc config

# Show current config
sc config --show

# Set AI provider
sc config --provider ollama
sc config --provider openai
sc config --provider anthropic
sc config --provider gemini

# Set commit style
sc config --style conventional   # feat:, fix:, docs:
sc config --style emoji          # ✨, πŸ›, πŸ“
sc config --style simple         # Add, Fix, Update

# Set output language
sc config --language english
sc config --language indonesian
sc config --language spanish

# Set API key
sc config --api-key sk-your-key-here

# Set specific model
sc config --model gpt-4o
sc config --model claude-3-5-sonnet-20241022
sc config --model llama3.2

Git Alias

Add this to your ~/.gitconfig for even faster access:

[alias]
    ai = !sc

Then just use:

git ai
git ai --all
git ai --yes

πŸ€– Supported Providers

Provider Model Free? Setup
Ollama llama3.2, codellama, etc. βœ… Yes Install Ollama
OpenAI gpt-4o-mini, gpt-4o ❌ Get API key
Anthropic Claude 3.5 Sonnet ❌ Get API key
Gemini gemini-2.0-flash βœ… Free tier Get API key

Using Ollama (Free & Local)

# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh

# Pull a model
ollama pull llama3.2

# Configure smart-commit
sc config --provider ollama --model llama3.2

βš™οΈ Configuration

Config is stored in ~/.smart-commit/config.json:

{
  "provider": "openai",
  "model": "gpt-4o-mini",
  "apiKey": "sk-...",
  "language": "english",
  "style": "conventional",
  "autoCommit": false,
  "temperature": 0.3
}

Environment Variables

You can also use environment variables instead of storing API keys:

export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...
export GEMINI_API_KEY=...

πŸ“ Commit Styles

Conventional Commits (default)

feat(auth): add OAuth2 login flow
fix(api): handle null response in user endpoint
docs: update installation guide
refactor(utils): simplify date formatting logic

Gitmoji

✨ feat: add dark mode toggle
πŸ› fix: resolve memory leak in worker pool
πŸ“ docs: add API reference for v2
♻️ refactor: extract payment logic to service

Simple

Add dark mode toggle to settings page
Fix memory leak in background worker pool
Update API reference documentation
Extract payment processing into separate service

🀝 Contributing

Contributions are welcome! Here's how to get started:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feat/amazing-feature)
  3. Commit your changes (sc --yes)
  4. Push to the branch (git push origin feat/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

MIT Β© Lwuisyy


If this tool helped you, consider giving it a ⭐ on GitHub!

About

πŸ€– AI-powered Git commit message generator from your staged changes

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors