We've all been there.
It's 11pm. You've been debugging for hours. You finally fix the bug. Time to commit.
git commit -m "fix stuff"
Or my personal favorite:
git commit -m "asdfasdf"
Your git history looks like a crime scene. Code reviews are painful because nobody knows what each commit actually did. And six months later, you're trying to figure out why you made a change and the commit message just says "update".
I got tired of this. So I built aigit.
What is aigit?
It's a CLI tool that uses AI to write your commit messages, branch names, and PR descriptions. You make changes, run a command, and it figures out what you did.
Commit messages:
git add .
aigit commit
→ "feat: add JWT authentication with refresh token support"
Branch names:
aigit branch "add user login"
→ feature/add-user-login-authentication
Pull requests:
aigit pr
→ Creates PR with title and detailed description based on your changes
It also does code review and can explain what changed in any commit.
How it works
aigit reads your git diff, sends it to OpenAI, and gets back a properly formatted message. It uses conventional commits format by default (feat, fix, docs, etc.) so your git history stays consistent.
The key is in the prompts. I spent time crafting prompts that generate concise, meaningful messages - not the verbose essays that AI tends to write.
For example, the commit prompt tells the AI:
- First line: 50 chars max, imperative mood
- Focus on WHAT changed and WHY, not HOW
- Be specific, avoid vague words like "update" or "fix"
Installation
brew install pipx
pipx install git+https://github.com/hardiksondagar/aigit.git
Then set your OpenAI API key:
aigit config set openai_api_key sk-your-key
That's it. Now aigit commit works from any repo.
The commands
aigit commit - Generate commit message from staged changes
aigit commit -a - Stage all and commit
aigit commit -m "auth stuff" - Give AI a hint for better messages
aigit branch "description" - Generate branch name
aigit pr - Create GitHub PR with AI-generated title and description
aigit review - Code review for bugs, security issues, style
aigit explain - Explain what changed in a commit or branch
What's next
I'm working on a "branch context" feature - a markdown file that tracks what you're building on each branch. It auto-updates with every commit and serves as context for AI code editors like Cursor.
The idea: your AI editor knows exactly what you're working on because there's a living document explaining it.
Other planned features:
- Changelog generation from commits
- Support for Claude, Ollama (local/offline), Gemini
- Custom prompt templates for teams
Try it
GitHub: https://github.com/hardiksondagar/aigit
It's open source, free to use, and costs about $0.01 per commit with gpt-4o-mini.
If you've ever written a commit message you're ashamed of, give it a shot. Your future self (and your teammates) will thank you.
What's the worst commit message you've ever written? I'll go first: "idk"
Top comments (0)