🤖 Automated Git workflow with AI-generated commit messages
Transform your Git workflow with one command - powered by Google Gemini AI
📦 Install from NPM • 🔑 Get API Key • 📖 Documentation
npm i auto-git-aiReplace this:
git add . && git commit -m "updated stuff" && git pushWith this:
npx auto-git-ai # ✨ AI analyzes changes and creates meaningful commits🎯 Features: AI commit messages • One-command workflow • Smart staging • Conventional commits
# 1. Install
npm i auto-git-ai
# 2. Set API key (get from: https://aistudio.google.com/app/apikey)
# For Bash or Zsh:
export GEMINI_API_KEY="your-api-key-here"
or
# For Fish shell:
set -x GEMINI_API_KEY "your-api-key-here"
# 3. Use directly (no need to install globally)
npx auto-git-ai- Analyzes your local changes vs remote repository
- Understands context: file types, functions, patterns
- Generates meaningful commit messages using AI
- Commits & pushes with conventional format (
feat:,fix:, etc.)
# Example: You add a new function
+ function calculateTotal(items) { ... }
# AI generates:
# feat: implement calculateTotal function for price computation# 1. Install once globally (from NPM: https://www.npmjs.com/package/auto-git-ai)
npm i auto-git-ai
# 2. Work on your project
cd my-awesome-project
git remote add origin https://github.com/username/my-awesome-project.git
# 3. Make some changes
echo "const api = 'https://api.example.com';" > config.js
mkdir components && echo "<Button>Click me</Button>" > components/Button.js
# 4. Run the magic command
npx auto-git-ai
# 🎝 Watch the AI work:
# 🚀 Auto-git: Automated Git workflow with AI
# 📁 Staging changes...
# 🤖 Generating commit message with AI...
# 📦 Commit message: feat: add API config and Button component
# 📂 Committing changes...
# 🚀 Pushing to origin/main...
# ✅ Successfully pushed changes to remote repository!The AI doesn't just randomly generate commit messages. Here's the intelligent process:
- 📊 Compares Local vs Remote - Analyzes what's different
- 🔍 Reads Your Changes - Understands code diff
- 🎯 Understands Context - File types, functions, patterns
- 📝 Generates Message - Based on actual code edits
- ✅ Follows Standards - Uses conventional commit format
# Your changes:
+ function calculateTotal(items) { return items.reduce((sum, item) => sum + item.price, 0); }
+ export { calculateTotal };
- // TODO: implement calculation logic
# AI Analysis Result:
# ✅ Commit message: feat: implement calculateTotal function for price computation🚀 Works with any programming language, any project size, anywhere you have Git!
- Node.js 14.0.0+
- Git repository with remote
- Gemini API Key from Google AI Studio
export GEMINI_API_KEY="your-api-key-here"Or add a .env file:
GEMINI_API_KEY=your-api-key-here| Your Changes | AI Generated Message |
|---|---|
| Added new component | feat: add UserProfile component |
| Fixed null error | fix: handle null values in parseUser |
| Updated docs | docs: update installation instructions |
| Refactored code | refactor: optimize user data queries |
"GEMINI_API_KEY not set"
→ export GEMINI_API_KEY="your-key"
"Not in Git repository" → Navigate to a Git directory
"No remote 'origin'"
→ git remote add origin <url>
- ✅ API key is read from environment variables only
- ✅ No sensitive data is logged or stored locally
- ✅ Uses your existing Git credentials and configuration
- ✅ Only sends git diff data to Gemini API for commit message generation
MIT License
MIT License
Copyright (c) 2025 Lalit
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Contributions are welcome! Please feel free to:
- 🤛 Report bugs
- 💡 Suggest new features
- 🔧 Submit pull requests
- 📖 Improve documentation
Conventional Commits • Google Gemini AI
Report Issues • Feature Requests
⭐ Star this package on NPM if it helps your workflow!