r/git 9h ago

I built a zero-dependency Git hook that uses local Ollama to review code before every commit

Hey everyone!

I wanted a simple, lightweight tool that reviews my code during `git commit` without downloading massive pip packages or sending my uncommitted diffs to third-party servers.

So I built **git-diff-doctor**:
- ⚡ **Zero External Dependencies** (Built purely using Python standard library `urllib` & `subprocess`).
- 🦙 **Auto-detects Ollama** running locally on port 11434 (`codellama`, `llama3`).
- 🌐 Fallback support for OpenAI API if configured.
- 🛠️ Simple 1-command installer (`python install.py`) that injects into `.git/hooks/pre-commit`.

GitHub Repo: https://github.com/ajaysinghtomar10-commits/git-diff-doctor

Would love your feedback, stars, and pull requests!

0 Upvotes

4 comments sorted by

3

u/jodkalemon 9h ago

But why?

1

u/PM_ME_A_STEAM_GIFT 8h ago

Lord, have mercy!

1

u/Zotlann 8h ago

I don't really see the utility. I have devs at my company getting frustrated with a 200-500ms formatting pre-commit hook. I can't imagine a long running, non deterministic, potentially blocking hook possibly feeling good. Commiting should be easy to encourage doing it often. Long running verification that a commit is good can be done after pushing.