DEV Community

Cover image for CommitAI — Local AI-Powered Git Assistant Using Gemma 4
Yuva Kunaal
Yuva Kunaal

Posted on

CommitAI — Local AI-Powered Git Assistant Using Gemma 4

Gemma 4 Challenge: Build With Gemma 4 Submission

This is a submission for the Gemma 4 Challenge: Build with Gemma 4

What I Built

As developers, we repeatedly write commit messages, maintain changelogs, and switch context during development. I wanted to build a lightweight developer tool that could automate this workflow completely offline without relying on cloud APIs or external AI services.

So I built CommitAI — a local AI-powered Git assistant using Gemma 4 + Ollama.

The workflow is simple:

  • Read staged Git diff
  • Send it to a local Gemma 4 model
  • Generate a clean Conventional Commit message
  • Update changelog automatically
  • Execute the Git commit

I also added Git hook integration so the workflow becomes:

git add .
git commit
Enter fullscreen mode Exit fullscreen mode

and the AI handles the rest.

The project is built entirely in Python and runs locally on my MacBook Air M2 (8GB RAM).

Features

  • AI-generated Conventional Commit messages
  • Automatic changelog generation
  • Git hook integration
  • Fully local/offline workflow
  • Rich CLI interface using the Rich library
  • No external APIs
  • Privacy-friendly local inference
  • Uses staged Git diffs as context

Demo

Demo Video

Code

CommitAI Repo

How I Used Gemma 4

I used the gemma4:e2b model through Ollama for all AI-powered functionality inside CommitAI.

I specifically chose the E2B model because:

  • it runs efficiently on local hardware
  • lightweight enough for my MacBook Air M2 with 8GB RAM
  • low-latency responses for CLI workflows
  • strong enough reasoning for summarizing Git diffs
  • ideal for privacy-focused offline tooling

Gemma 4 powers:

  • commit message generation
  • changelog summarization
  • Git workflow automation

Architecture

Git Diff
   ↓
CommitAI
   ↓
Ollama API
   ↓
Gemma 4 (E2B)
   ↓
AI-generated commit/changelog
   ↓
Git commit execution
Enter fullscreen mode Exit fullscreen mode

Tech Stack

  • Python
  • Ollama
  • Gemma 4 (gemma4:e2b)
  • Rich
  • Git Hooks

Future Improvements

  • PR description generation
  • Multi-model support
  • Better diff summarization
  • VSCode extension
  • Team changelog modes
  • Interactive commit editing

One of my biggest goals with this project was proving that useful AI developer tooling can run fully locally without depending on cloud APIs.

Thanks for reading 🚀

Top comments (0)