gcmg
v2.1.0
Published
A tool to generate commit messages and commands for git
Readme
GCMG - Git Commit Message Generator
Intelligent AI-powered commit message generation for developers who value quality and consistency. Transform your git workflow with smart, standardized commit messages generated from your actual code changes.
Features
Smart Commit Generation - Analyzes your git diff to create meaningful, descriptive commit messages
Multi-AI Provider Support - Choose from OpenAI, Anthropic, Google, Groq, and more
Lightning Fast - Built with esbuild for optimal performance
Interactive Setup - Guided configuration with CLI prompts
Standardized Format - Consistent commit message structure across your projects
Cross-Platform - Works seamlessly on Windows, macOS, and Linux
Auto Git Operations - Optional automatic add, commit, and push workflow
AI Query Mode - Ask questions about git commands and get instant help
What Makes GCMG Special
Intelligent Analysis
- Reads your actual code changes via
git diff - Understands context and generates relevant commit messages
- Handles large diffs intelligently (with smart 10k character limit)
Multiple AI Personalities
Choose from the industry's best AI models:
| Provider | Models Available | Strengths | |----------|-----------------|-----------| | OpenAI | GPT-4, GPT-4o, o1, o3-mini | Most versatile, excellent reasoning | | Anthropic | Claude-4, Claude-3.5 Sonnet/Haiku | Superior code understanding | | Google | Gemini 2.0, Gemini 1.5 Pro/Flash | Fast and efficient | | Groq | Llama 3.3, Mixtral, Qwen | Lightning-fast inference | | Google Vertex | Enterprise Gemini models | Enterprise-grade reliability | | OpenRouter | All models from OpenAI, Anthropic, Google, Groq | All-in-one solution |
Perfect Commit Format
Every generated message follows this proven structure:
[feat] Add user authentication system
- Implement JWT token-based authentication
- Add login and logout endpoints
- Create user session management
- Add password encryption with bcrypt
... Enhances application security and user managementQuick Start
Installation
npm install -g gcmgSetup (One-time)
gcmg configFollow the interactive prompts to:
- Select your preferred AI provider
- Choose an AI model
- Enter your API key
Usage
# Make your changes
git add .
# Generate and commit
gcmg
# Or ask for help
gcmg "how do I remove sensitive data from git history?"Command Showcase
GCMG provides multiple command aliases for maximum convenience:
gcmg # Primary command
git msg or git cmg # Git message alias
git-msg # Short alias
git-commit-msg-generate # Descriptive aliasAvailable Commands
| Command | Description | Example |
|---------|-------------|---------|
| gcmg | Generate commit message from changes | gcmg |
| gcmg config | Interactive configuration setup | gcmg config |
| gcmg edit | Edit configuration file | gcmg edit |
| gcmg help | Show help message | gcmg help |
| gcmg <query> | Ask git-related questions | gcmg "revert last commit" |
Configuration
Configuration is stored securely in platform-appropriate locations:
- Windows:
%APPDATA%\gcmg\.gcmg-config - macOS:
~/Library/Application Support/gcmg/.gcmg-config - Linux:
~/.config/gcmg/.gcmg-config
Configuration Structure
{
"name": "OpenAI",
"provider": "@ai-sdk/openai",
"model": "gpt-4o",
"apiKey": "your-api-key",
"prompts": {
"commit": "Your custom commit prompt...",
"help": "Your custom help prompt..."
}
}Advanced Features
AI Query Mode
Get instant help with git commands:
gcmg "how to merge branches safely"
gcmg "undo last commit but keep changes"
gcmg "remove file from git history"Smart Diff Handling
- Automatically detects when no changes exist
- Warns about large diffs (>10k characters)
- Handles binary files and complex changes intelligently
Streamlined Workflow
- Analyze - Reads your git diff
- Generate - Creates intelligent commit message
- Review - Shows you the proposed message
- Commit - Optionally commits with
git add . && git commit - Push - Optionally pushes to remote repository
Architecture
GCMG is built with modern development practices:
- TypeScript - Type-safe development
- ESBuild - Lightning-fast compilation
- Vercel AI SDK - Unified AI provider interface
- Enquirer - Interactive prompts
- Zod - Runtime type validation
- Cross-platform - Works everywhere Node.js runs
Project Structure
gcmg/
├── src/
│ ├── commands/ # CLI command implementations
│ ├── lib/ # Core libraries (config, LLM, models)
│ ├── scripts/ # Build and utility scripts
│ └── prompts.ts # AI prompt templates
├── assets/ # Visual assets
└── dist/ # Built outputCommit Types
GCMG automatically categorizes your changes:
| Type | Description | Example |
|------|-------------|---------|
| feat | New features | [feat] Add dark mode toggle |
| fix | Bug fixes | [fix] Resolve login validation error |
| docs | Documentation | [docs] Update API documentation |
| style | Code formatting | [style] Fix indentation and spacing |
| refactor | Code refactoring | [refactor] Simplify user service logic |
| test | Testing | [test] Add unit tests for auth module |
| chore | Maintenance | [chore] Update dependencies |
Contributing
We welcome contributions! Here's how to get started:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes using GCMG itself! (
gcmg) - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Setup
git clone https://github.com/yashraj-n/gcmg.git
cd gcmg
npm install
npm run buildWhy GCMG?
Before GCMG
git commit -m "fix stuff"
git commit -m "update"
git commit -m "asdfgh"After GCMG
[fix] Resolve authentication middleware validation error
- Fix JWT token verification logic
- Add proper error handling for expired tokens
- Update middleware to handle edge cases
- Add comprehensive logging for debugging
... Improves application security and user experienceReal-World Example
$ gcmg
✓ Getting Changes...
✓ Generating Commit Message...
[feat] Implement user profile management system
- Add user profile CRUD operations
- Create profile update validation
- Implement avatar upload functionality
- Add email verification for profile changes
- Create comprehensive user settings page
... Enhances user experience with complete profile control
? Do you want to add and commit these changes? › Yes
✓ Changes committed successfully
? Do you want to push the changes? › Yes
✓ Changes pushed successfullyLicense
This project is licensed under the MIT License - see the LICENSE file for details.
Report Bug · Request Feature · Discussions
Made for developers who care about quality commits
