DEV Community

Abubakersiddique771
Abubakersiddique771

Posted on

I Trained an AI to Review My GitHub Commits 🧠💬

For Fun Weird Things:


“Imagine if your AI reviewer knew your bad habits better than your teammates do.”

Let’s face it.
Most of us commit like this:

git commit -m "fix"
Enter fullscreen mode Exit fullscreen mode

or worse:

git commit -m "idk it works now"
Enter fullscreen mode Exit fullscreen mode

But what if… instead of teaching devs to write better commits — we trained an AI to understand our bad ones?

In this post, I show how I:

  • Scraped my own GitHub commit history 🧾
  • Used AI to extract patterns, tone, and mistakes 🔍
  • Built a “self-reviewer” bot that sends me DMs when I go rogue 🤖

And it’s both funny and terrifyingly useful.


🧩 The Real Problem: No One Teaches Git Hygiene

We all know this feeling:

  • Too lazy to explain why you changed 40 files
  • Push to main with “last changes fr”
  • Later realize you can’t remember why any of it mattered

Code quality often gets attention.
Commit quality? Almost never.

And bad commit history = painful debugging, poor collaboration, weak PR storytelling.

So instead of fixing my habits manually…

I built an AI to catch me in the act.


🧠 The Idea: Train an LLM on Your Git Commits

Instead of giving AI the perfect commits from big open source projects, I did the opposite:

I trained it on my worst commits — and the consequences that followed.

What the AI learns:

  • My sloppy commit patterns
  • Repeated fixes (e.g. “fix typo” after “initial commit”)
  • How rushed commits lead to hotfix PRs later
  • My preferred file types and what I usually forget to include

🛠️ The Stack

Purpose Tool / Stack Used
Git data extraction git log --pretty + Python
LLM for classification OpenAI, Claude, or Phi-3
Vector storage ChromaDB
Self-review prompt design LangChain chains
Alerts Discord bot + Git hook integration

📦 How It Works

  1. 🧲 Extract commits
   git log --pretty=format:"%h %s" > commits.txt
Enter fullscreen mode Exit fullscreen mode
  1. 🧠 Analyze tone, intent, and pattern Use an LLM to tag each commit:
  • Type: Feature / Fix / Refactor / Docs
  • Emotion: Rushed / Calm / Confused
  • Quality: High / Mid / yikes
  • Pattern: “Fix after bad push” / “Rename cycles” / “Too big”
  1. 📈 Visualize recurring sins Example output:
   🟡 32% of your commits are over 300 LOC and titled 'misc'
   🔴 18 hotfix commits within 6 hours of a large push
   ⚠️ You often forget to mention DB changes in the commit message
Enter fullscreen mode Exit fullscreen mode
  1. 💬 Real-time Git hook + AI Review When I commit, it runs:
   ai_commit_reviewer "Fix deployment again"
Enter fullscreen mode Exit fullscreen mode

And replies:

“You’ve used a similar message 9 times. It usually led to follow-up commits. Consider explaining why it was fixed.”


🧪 The Funniest Discoveries

  • 14 commits titled “final version” were never final
  • I had a “README update” commit that changed 38 other files 😅
  • 47% of my Python commits lacked related test changes
  • My Sunday night commits were 2x more likely to be reverted

🤖 Bonus: I Asked GPT to Rewrite My Commit History

Just for fun, I took my repo and used GPT-4 to rewrite the messages in a clean, standardized format.

Before:

fix again lol
final2
working now?
asdfasdf
Enter fullscreen mode Exit fullscreen mode

After:

Fix retry logic in payment gateway integration
Finalize API response schema for `/v1/planets`
Resolve null reference bug in user profile page
Enter fullscreen mode Exit fullscreen mode

Then I re-read my project like it was made by someone professional.
Wild difference.


🧬 AI / ML Tint: Pattern Detection Over Time

I added an LLM fine-tuned model using BERTweet to detect:

  • Passive-aggressive commit tone 🤬
  • Tired/hurried language like “quick fix,” “temp,” or “hotfix”
  • Negative emotions → often precede messy merges

Future idea: Turn this into a time-series chart to predict “sloppy commit weeks” and auto-flag them in PR reviews.


🧘 The Educational Payoff

This wasn't just for fun. Here's what I learned:

✅ I now understand how my workflow causes bugs
✅ I spend less time reverse-engineering past commits
✅ I treat commit messages like mini PRs
✅ My future teammates (and my future self) thank me


✨ You Can Build It Too

Want to catch your own bad dev habits?

Tools you need:

  • Python
  • Git logs from your main projects
  • A basic LLM API (or local Ollama + Phi-3)
  • ChromaDB
  • Time (and courage) to face your sins

Let me know and I’ll open-source this as ai-commit-critic 💥


🧠 Final Thoughts: Your Commits Are a Diary

Your code tells what you built.
Your commits tell who you were when you built it.

And if you train AI to read them properly…

You don’t just get better code.
You become a better developer.


💬 Tired of Building for Likes Instead of Income?

I was too. So I started creating simple digital tools and kits that actually make money — without needing a big audience, fancy code, or endless hustle.

🔓 Premium Bundles for Devs. Who Want to Break Free

These are shortcuts to doing your own thing and making it pay:

🔧 Quick Kits (Take 1 Product That Actually Works for You)

These are personal wins turned into plug-and-play kits — short instruction guides:

👉 Browse all tools and micro-business kits here
👉 Browse all blueprints here

Top comments (3)

Collapse
 
nevodavid profile image
Nevo David

Pretty cool actually seeing your own bad commit habits turned into something useful. I mess up stuff like this all the time- kinda makes me wanna try it just for the laughs.

Collapse
 
dotallio profile image
Dotallio

I love how you turned commit shame into a feature - makes me rethink my own 'fix' spam. Is your AI reviewer customizable for team quirks too?

Collapse
 
sadia_ahmed profile image
Sadia Ahmed

Im going to try it, that's going to be my next project. Thanks!