builtbylukas.dev

commit-ai 🪄 – Automated Commit Messages

How I'm generating meaningful commit messages using AI

Example image that shows how commit-ai was used to generate a commit message in the terminal
commit-ai is an open source project that will help you generate concise and correct git commit messages quickly. All you need is an API key!

Basic implementation

How does commit-ai work? Well, it first fetches your custom options (if exist) and your git diff. Afterwards, it builds the prompt to generate your commit message. To do so, commit-ai aggregates the git diff, custom instructions and other files based on your commit-ai.json configuration file.

commit-ai then sends your prompt over to an API provider - currently I'm using Anthropic's Claude Sonnet, but I plan on making the model customizable in the future.

How to use

I'm sure you can't wait to use commit-ai yourself. And yes, it's possible. Quickly generate your customized and accurate commit messages yourself, using AI: commit-ai on GitHub

Related blog articles