commitdiff
v1.0.1
Published
AI-powered git commit message generator
Maintainers
Readme
CommitDiff CLI
AI-powered git commit message generator for your terminal.
Stop wasting time writing commit messages. Let AI analyze your code changes and generate professional, conventional commits in seconds.
🚀 Quick Start
Installation
# Install globally
npm install -g commitdiff
# Or use with npx (no installation required)
npx commitdiffUsage
# Stage your changes
git add .
# Generate commit message
commitdiff
# Or auto-commit with the generated message
commitdiff --commitThat's it! CommitDiff will analyze your staged changes and generate a professional commit message.
📖 Features
- ⚡ Lightning Fast - Generate commit messages in under 2 seconds
- 🎯 Conventional Commits - Follows conventional commit standards automatically
- 🤖 AI-Powered - Uses GPT-4o-mini to understand your code changes
- 🔒 Privacy First - Your code is never stored, only processed
- 💻 Zero Config - Works out of the box, no setup required
- 🌐 Language Agnostic - Works with any programming language
🔧 Commands & Options
Basic Command
commitdiff [options]Options
| Option | Description | Default |
| ---------------- | ------------------------------------------- | ------- |
| --commit | Automatically commit with generated message | false |
| --style <type> | Commit style:conventional | short |
| -V, --version | Output the version number | - |
| -h, --help | Display help for command | - |
Examples
# Generate a conventional commit message
commitdiff
# Generate and auto-commit
commitdiff --commit
# Use detailed commit style
commitdiff --style detailed
# Use short commit style
commitdiff --style short📝 Example Output
Input (your staged changes)
git add src/auth.ts
commitdiffOutput
🔍 Analyzing staged changes...
🤖 Generating commit message with AI...
✨ Generated Commit Message:
📝 feat(auth): add JWT token validation middleware
Summary:
• Implemented JWT token verification in auth middleware
• Added error handling for expired and invalid tokens
• Updated authentication flow to use new validation
────────────────────────────────────────────────────────────
💻 To commit with this message, run:
git commit -m "feat(auth): add JWT token validation middleware"🎯 How It Works
- Stage your changes - Use
git addto stage the files you want to commit - Run commitdiff - The CLI reads your staged diff and sends it to our AI
- Get your message - Receive a professional, conventional commit message
- Commit - Use the generated message or auto-commit with
--commit
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ git add │ ───> │ commitdiff │ ───> │ AI Analysis │
│ (stage) │ │ (reads) │ │ (generate) │
└─────────────┘ └─────────────┘ └─────────────┘
│
v
┌─────────────┐
│ git commit │
│ (apply) │
└─────────────┘🔐 Privacy & Security
- No Storage - Your code diffs are never stored on our servers
- Secure Processing - All requests use HTTPS encryption
- No Tracking - We don't track or analyze your code
- Open Source - Full transparency, view the code
💡 Tips & Best Practices
1. Stage Meaningful Changes
# Good - stage related changes together
git add src/auth/ tests/auth.test.ts
# Avoid - staging everything at once
git add . # Only if changes are related2. Review Before Committing
Always review the generated message before committing. The AI is smart, but you know your code best.
3. Use Auto-commit Wisely
# Use auto-commit for quick iterations
commitdiff --commit
# But review important changes manually
commitdiff # then copy and edit if needed4. Combine with Git Hooks
Add commitdiff to your git hooks for team consistency:
# .git/hooks/prepare-commit-msg
#!/bin/bash
commitdiff > .git/COMMIT_EDITMSG🌐 Web Interface
Prefer a web interface? Try our online version at commitdiff.vercel.app
🤝 Contributing
We welcome contributions! Here's how you can help:
- Report Bugs - Open an issue
- Suggest Features - Request a feature
- Submit PRs - Contributing guide
📚 Related Resources
📋 Requirements
- Node.js 18.0.0 or higher
- Git installed and configured
- Active internet connection (for AI processing)
❓ FAQ
🐛 Troubleshooting
"No staged changes found"
# Make sure you've staged your changes first
git add <files>"Failed to generate commit message"
- Check your internet connection
- Verify you're in a git repository
- Try again (rate limit may have been hit)
"Command not found: commitdiff"
# Reinstall globally
npm install -g commitdiff
# Or use npx
npx commitdiff📄 License
MIT License - see LICENSE for details.
👨💻 Author
Timothy Okoduwa
- Twitter: @timothyokoduwa
- GitHub: @timothy-okoduwa
- Website: commitdiff.vercel.app
⭐ Star on GitHub • 🐦 Follow on Twitter • 🌐 Try Online
