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 diffand 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-commitfetches 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)