my-commit
v0.1.2
Published
๐ค AI-powered Git commit message generator with interactive selection
Maintainers
Readme
๐ค my-commit
AI-powered Git commit message generator with interactive selection
Transform your Git workflow with AI-generated commit messages that follow conventional commit standards. Choose from multiple AI backends and enjoy a beautiful interactive interface powered by fzf.
โจ Features
- ๐ค Multiple AI Backends: OpenCode, Ollama
- ๐ฏ Interactive Selection: Beautiful fzf interface with keyboard shortcuts
- ๐ Multiple Commit Modes: Quick, detailed, or manual editing
- ๐ Cross-Platform: Works on macOS, Linux, and Windows (Git Bash/WSL)
- โก Fast & Efficient: Generates 5 contextual commit message options
- ๐จ Rich Preview: See diff stats and changes before committing
- ๐ Conventional Commits: Follows industry-standard commit message format
๐ Quick Start
# Install globally
npm install -g my-commit
# Stage your changes
git add .
# Generate and select commit message
my-commit๐ฆ Installation
Global Installation (Recommended)
npm install -g my-commitPrerequisites
my-commit requires the following dependencies:
- Git - Version control system
- fzf - Interactive fuzzy finder
- AI Backend - At least one of:
Platform-Specific Setup
# Install dependencies with Homebrew
brew install git fzf
# Install OpenCode (recommended)
# Visit https://opencode.dev for installation
# OR install Ollama for local AI
brew install ollama
ollama serve # Run in background
ollama pull llama3.1:8b
# Install my-commit
npm install -g my-commit# Ubuntu/Debian
sudo apt-get update
sudo apt-get install git fzf curl
# RHEL/CentOS/Fedora
sudo dnf install git fzf curl
# Arch Linux
sudo pacman -S git fzf curl
# Install Ollama (optional)
curl -fsSL https://ollama.ai/install.sh | sh
ollama serve &
ollama pull llama3.1:8b
# Install my-commit
npm install -g my-commit# Using Chocolatey
choco install git fzf
# Using Scoop
scoop install git fzf
# Using winget
winget install Git.Git junegunn.fzf
# Install my-commit in Git Bash or PowerShell
npm install -g my-commit๐ฎ Usage
Basic Usage
# Stage your changes
git add .
# Run my-commit
my-commitInteractive Interface
When you run my-commit, you'll see an interactive menu with:
- ๐ Enter: Quick commit (fastest)
- ๐ Tab: Generate detailed commit body with AI
- โ๏ธ Ctrl-E: Edit message in your default editor
- โ Esc: Cancel operation
Command Line Options
my-commit [options]
Options:
-b, --backend <name> AI backend (opencode, ollama)
-d, --dry-run Show generated messages without committing
-v, --verbose Enable verbose output
-t, --template <path> Use custom commit message template
-c, --config <path> Use custom configuration file
-h, --help Display help information
--version Show version number
Commands:
backends List available AI backendsExamples
# Use specific AI backend
my-commit --backend ollama
# Dry run to see generated messages
my-commit --dry-run
# Verbose output for debugging
my-commit --verbose
# List available backends
my-commit backends๐ง AI Backends
my-commit supports multiple AI backends with automatic fallback:
1. OpenCode (Recommended)
# Install from https://opencode.dev
# No additional configuration required2. Ollama (Local AI)
# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh # Linux/macOS
# or visit https://ollama.ai for Windows
# Start Ollama service
ollama serve
# Pull a model
ollama pull llama3.1:8b๐ Commit Message Format
my-commit generates messages following the Conventional Commits specification:
<type>: <description>
[optional body]
[optional footer(s)]Common Types
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Example Generated Messages
feat: Add user authentication with JWT tokens
fix: Resolve memory leak in image processing pipeline
docs: Update API documentation for v2.0 endpoints
refactor: Extract database utilities into separate module
style: Apply ESLint formatting rules to components๐ ๏ธ Configuration
Environment Variables
# Editor preference (for edit mode)
export EDITOR="code" # VS Code
export EDITOR="vim" # Vim
export EDITOR="nano" # NanoCustom Templates (Future Feature)
# Use custom commit template
my-commit --template ~/.config/my-commit/template.txt๐ง Troubleshooting
Common Issues
"No AI backend available"
- Install OpenCode from https://opencode.dev
- OR set up Ollama:
ollama serve && ollama pull llama3.1:8b
"fzf not found"
- macOS:
brew install fzf - Linux:
sudo apt-get install fzf - Windows:
choco install fzf
"Not a git repository"
- Run
git initto initialize a repository - Ensure you're in the correct directory
"No staged changes"
- Run
git add .to stage all changes - Or
git add <specific-files>for selective staging
Debug Mode
# Enable verbose output
my-commit --verbose
# Check backend availability
my-commit backends
# Test without committing
my-commit --dry-run๐ค Contributing
We welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and test thoroughly
- Run the linter:
npm run lint - Submit a pull request
Development Setup
# Clone the repository
git clone https://github.com/username/my-commit.git
cd my-commit
# Install dependencies
npm install
# Build TypeScript
npm run build
# Test locally
npm link
my-commit --helpAdding New AI Backends
To add a new AI backend:
- Implement the
AIBackendinterface insrc/ai-backends.ts - Add your backend to the
BackendRegistry - Update documentation and tests
๐ Roadmap
- [ ] Custom Templates: User-defined commit message templates
- [ ] Team Configurations: Shared commit styles across teams
- [ ] Git Hooks Integration: Automatic commit message validation
- [ ] Commit Analytics: Track commit patterns and suggestions
- [ ] Plugin System: Extensible architecture for custom backends
- [ ] Configuration File:
.my-commit.jsonfor project-specific settings
๐ License
MIT License - see LICENSE file for details.
๐ Acknowledgments
- fzf - Amazing fuzzy finder
- OpenCode - AI coding assistant
- Conventional Commits - Commit message specification
๐ Support
- Documentation: Full documentation
- Issues: Report bugs
- Discussions: Community discussions
Made with โค๏ธ for developers who care about clean Git history
