Building git-commit-reviews.py — My Attempt at Smarter, Faster Code Quality
Manual code reviews are vital, but they’re also slow, repetitive, and easy to miss things in. I wanted an automated reviewer that fits cleanly into a Git workflow, scans each commit, and gives structured, intelligent feedback.
The goal was simple: create a lightweight tool that reviews every commit automatically and surfaces meaningful issues without slowing anyone down. That exploration became a Python script that watches your repos, pulls diffs, and feeds them to an LLM of your choice.
What the Script Does
The script crawls through your Git commits, extracts diffs, and sends them to an LLM via a controlled, structured prompt. The model returns a JSON-like review containing:
- Bugs or suspicious logic
- Security issues
- Performance or maintainability concerns
- Severity classification
- Improvement suggestions
How It Works
Scanning recent commits
The script fetches commits using Git CLI, respecting filters like branch, “since: 24 hours ago”, etc.
command = ['git', 'log', f'--since="{since}"', '--pretty=format:%H%n%s%n%an']
Learn more about How to Build an AI-Powered Git Commit Reviewer with Python and LLMs
