Skip to content

root4nishant/gemmit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 gemmit

✨ Generate smart, AI-powered Git commit messages using Gemini. One command, zero thinking.


🚀 What is Gemmit?

Gemmit is a lightweight CLI tool that uses Google Gemini AI to automatically generate meaningful Git commit messages based on your staged code changes. Whether you're fixing a typo or refactoring a feature, Gemmit turns your git diff into a polished commit.


📦 Installation

▶️ Quick one-time usage

npx gemmit -- "fix #42"

📌 Or install locally

npm install --save-dev gemmit

Add a script:

"scripts": {
  "ai-commit": "gemmit"
}

Run with:

npm run ai-commit -- "fix #42"

🛠 Setup

Before running gemmit, create a config file in your project root:

cp node_modules/gemmit/config/config.example.sh ./ai-commit.config.sh

Then edit ai-commit.config.sh and add:

API_KEY="your-gemini-api-key"
MODEL_NAME="gemini-2.0-flash" # or gemini-2.0-pro
PYTHON_PATH="/your/python/path"

✅ That’s it — you're ready!


✏️ Usage

From a Git-tracked project:

npx gemmit -- "fix #123"

Or just:

npx gemmit

If you don’t pass a prefix, it just uses the AI output.

The AI will read your git diff --cached, send it to Gemini, and generate a commit like:

fix #123 Adjust null check in login validator

Gemmit combines this with your prefix and commits:

git commit -m "fix #123 Adjust null check in login validator"
git push

🔐 API Key Management

Gemmit supports 3 flexible config methods:

  1. Config file: ./ai-commit.config.sh (preferred)
  2. Environment variables:
    export GEMMIT_API_KEY="..."
    export GEMMIT_MODEL_NAME="gemini-2.0-flash"
    export GEMMIT_PYTHON_PATH="/usr/bin/python3"
  3. .env (optional):
    GEMMIT_API_KEY=...

🧪 Example Workflow

git add .
npx gemmit -- "fix #56"

💬 Gemini reads your staged code changes and replies with:

Fix login validation for empty email

Gemmit combines this with your prefix and commits:

fix #56 Fix login validation for empty email

Then it runs:

git commit -m "fix #56 Fix login validation for empty email"
git push

📄 License

MIT © root4nishant


🧠 Powered by

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published