Quick Start Guide
November 10, 2025 ยท View on GitHub
๐ Get AI-Powered Commits in 30 Seconds
1. Set your API key
export OPENAI_API_KEY="your-api-key-here"
Get your key at: https://platform.openai.com/api-keys
2. Install hooks (one command!)
npx git-rewrite-commits --install-hooks
3. Start committing with AI
git add .
git commit
# โจ AI message appears automatically in your editor!
What Gets Installed?
๐ prepare-commit-msg
- When: Every time you run
git commit - What: Generates AI message based on your staged changes
- Result: Editor opens with perfect commit message ready to use
โ post-commit
- When: After you commit
- What: Reviews and improves your commit message
- Result: Automatically fixes poor messages
๐ pre-push
- When: Before
git push - What: Reviews unpushed commits
- Result: Offers to fix messages before pushing
Configuration (Optional)
Set your team's format
git config hooks.commitTemplate "[JIRA-XXX] feat: message"
Set language
git config hooks.commitLanguage "es" # Spanish
git config hooks.commitLanguage "fr" # French
git config hooks.commitLanguage "ja" # Japanese
Uninstall Hooks
To remove hooks:
rm .git/hooks/prepare-commit-msg
rm .git/hooks/post-commit
rm .git/hooks/pre-push
Examples
What You Type
git add src/auth.ts
git commit
What You Get (automatically!)
feat(auth): implement JWT token validation middleware
# โจ AI-generated commit message above
# Feel free to edit as needed before saving
#
# Files being committed:
# M src/auth.ts
Troubleshooting
API Key Not Set?
export OPENAI_API_KEY="sk-..."
# Add to ~/.bashrc or ~/.zshrc to make permanent
Hooks Not Working?
# Check if installed
ls -la .git/hooks/
# Reinstall
npx git-rewrite-commits --install-hooks
Want Different Template?
# Per repository
git config hooks.commitTemplate "๐ feat: message"
# Global (all repositories)
git config --global hooks.commitTemplate "feat(scope): message"
Why Use This?
- โ Zero effort - AI writes your commit messages
- โ Consistent format - Always follows conventions
- โ Team-friendly - Everyone gets same quality
- โ Time-saving - No more thinking about messages
- โ Educational - Learn good commit practices
Next Steps
- Try the tool on a test repository first
- Configure your preferred template
- Share with your team!
Need help? Create an issue at: https://github.com/yourusername/git-rewrite-commits