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! π
Top comments (0)