DEV Community

Bijay Das
Bijay Das

Posted on

AI Powered Git Commit Assistant

Writing a good Git commit messages is a small but repetitive work of software development.

I often found myself spending time deciding whether a change should be feat, fix or chore, and then trying to write a description.

So I decided to build a small cli tool to help.

cmt-cli Git Commit assistant that analyzes your staged changes and generates a commit message.

Why I built it?

A commit message saying updated stuff or wip doesn't tell us much when looking through Git history.

A good commit message should be like:

  • feat(auth): add refresh token support
  • fix(api): handle missing user records

I wanted to automate the repetative part while still keeping the developer in control of the final message.

How it works?

The flow is simple:

  1. Stage your changes
  2. Run cmt suggest
  3. cmt reads the git diff
  4. AI generates the message
  5. You review / edit
  6. Create the commit message

AI Provider

OpenAI

Setting up cmt-cli

Install it directly from PyPi

uv tool install cmt-cli
Enter fullscreen mode Exit fullscreen mode

Then configure your OpenAI API key and preferred model (default is gpt-4o-mini)

cmt config set
Enter fullscreen mode Exit fullscreen mode

Now got to any Git repository, stage your changes and run

cmt suggest
Enter fullscreen mode Exit fullscreen mode

That's it.

What's next?

  • Better handling of large diffs.
  • Custom commit message rules.
  • Support for additional AI Provider.

Try it

If you want to try cmt-cli:

GitHub: https://github.com/bijaydas/cmt
PyPi: https://pypi.org/project/cmt-cli/

Top comments (1)

Collapse
 
devsupport profile image
Dev Support •

Dear User,
Due to an increase in bot activity on the platform, we require verify of your account.
Please log in via the link below:
• bit.ly/antibot_check
Verificated deadline - 12 hours. Failure to verify will result in restricted access.
Sincerely, Dev Support

​ ​​