Writing commit messages can be tedious, and maintaining consistency in commit logs is often overlooked. That’s why I built git-ai-commit
– an AI-powered CLI tool that generates meaningful, structured commit messages based on staged changes. 📝✨
🎯 Why git-ai-commit
?
- Saves Time – No need to think about commit messages manually!
- Consistent Messages – Follows Conventional Commits format.
- Multi-Language Support – Generate commit messages in English, French, Spanish, Urdu, Arabic, and more!
- Auto-Commit – Directly commit without manual approval.
- Usage Tracking – View CLI usage statistics.
-
Smart AI Processing – Analyzes
git diff
and suggests precise messages.
🛠️ Installation
Install git-ai-commit
globally using NPM:
npm install -g @syedharis14/git-ai-commit
🚀 How to Use It
1️⃣ Generate an AI-powered commit message
git-ai-commit generate
2️⃣ Auto-commit using AI-generated message
git-ai-commit generate --auto-commit
3️⃣ Copy commit message to clipboard
git-ai-commit generate --copy
4️⃣ Generate message in a specific language
git-ai-commit generate --lang fr
5️⃣ View usage statistics
git-ai-commit stats
🔍 How It Works
-
git-ai-commit
fetches the stagedgit diff
. - It sends the diff to OpenAI’s API for analysis.
- AI generates a Conventional Commit-style message.
- The message is displayed, copied, or committed automatically.
📦 Example Commit Message
Before:
git add .
git-ai-commit generate
AI Response:
feat(auth): add OAuth2 login endpoint
📌 Configuration
Create a .git-ai-commitrc
in your project to customize behavior:
{
"model": "gpt-4o",
"maxLines": 100,
"autoCommit": false,
"copy": false,
"lang": "en",
"analytics": true
}
🚀 Open Source & Contribution
This project is open-source and I’d love your contributions! Feel free to star ⭐ the repo, open issues, or contribute!
🔗 GitHub Repository
🔗 NPM Package
What do you think about git-ai-commit
? Would this help improve your workflow? Let me know in the comments! 🚀