Skip to content

rohitg00/git-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-ai

AI-powered git commit & push in one command. Uses Groq (free, blazing fast) to generate conventional commit messages from your diff.

git-ai                     # auto-generate commit message from diff
git-ai "added auth flow"   # provide context hint for better messages
git-ai --skip              # skip confirmation, commit and push immediately

Demo

▸ Generating commit message...

Changes to commit:
  src/auth.ts | 42 ++++++++++++++++++++++----
  src/db.ts   |  8 ++---
  2 files changed, 38 insertions(+), 12 deletions(-)

Commit message:
┌─────────────────────────────────────────────┐
│ feat(auth): add OAuth2 login flow           │
└─────────────────────────────────────────────┘

[Enter] Accept  [e] Edit  [r] Regenerate  [c] Cancel

Install (one command)

curl -fsSL https://raw.githubusercontent.com/rohitg00/git-ai/main/install.sh | bash

That's it. The installer:

  • Downloads git-ai to ~/.local/bin/
  • Makes it executable
  • Adds ~/.local/bin to your PATH if needed
  • Tells you exactly what to do next

Then add your free Groq API key:

export GROQ_API_KEY="your-key-here"  # add to ~/.zshrc or ~/.bashrc

Get your free key at console.groq.com → API Keys → Create (no credit card needed).

Manual install
curl -fsSL https://raw.githubusercontent.com/rohitg00/git-ai/main/git-ai -o ~/.local/bin/git-ai
chmod +x ~/.local/bin/git-ai
export PATH="$HOME/.local/bin:$PATH"

Uninstall

rm ~/.local/bin/git-ai

How it works

  1. Validates you're in a git repo with changes
  2. Stages modified/deleted tracked files (git add -u)
  3. Sends diff to Groq API → generates conventional commit message
  4. Shows diff summary + proposed message
  5. You accept, edit, regenerate, or cancel
  6. Commits and pushes to current branch

Untracked (new) files are never auto-staged — you explicitly git add them first.

Options

Key Action
Enter Accept message, commit and push
e Edit message in your $EDITOR
r Regenerate with a new API call
c Cancel and unstage all changes

Configuration

Variable Default Description
GROQ_API_KEY Required. Free API key from console.groq.com
GIT_AI_MODEL llama-3.3-70b-versatile Groq model to use
GIT_AI_MAX_DIFF 8000 Max diff chars sent to API

Why Groq?

  • Free — no credit card, 14,400 requests/day
  • Fast — LPU inference, sub-second responses
  • Smart — Llama 3.3 70B understands code diffs well
  • Simple — OpenAI-compatible API, just a curl call

Requirements

Git subcommand

Since the script is named git-ai, git automatically picks it up as a subcommand:

git ai                    # works the same as git-ai
git ai "refactored api"   # with context
git ai --skip             # auto-commit

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages