Stop writing your commit messages by hand and let AI do it for you

Richard Oliver Bray
3 min readApr 17, 2023

--

Boy typing on a laptop. Image generated by ai

Most of this article was generated by AI, based on a transcript from my TikTok video about the same topic.

Writing commit messages can be a super tedious task, and quite often we don’t put as much thought as we should into them. However, with the rise of AI, it’s never been easier to write good and informative commit messages really quickly.

The tools

One of the best tools I’ve seen that can do this is AI Commits. This is an open source tool that helps developers write clear and concise commit messages. AI Commits is written in Typescript and uses gpt 3.5 under the hood. It does a git diff then gets GPT to write a summary. All this happens in your terminal of choice in record time.

AI Commits repository on GitHub

Another great open source tool is OpenCommit, which is a similar to AI Commits, (Typescript, gpt model), but focuses on writing conventional commits and has Gitmoji support. OpenCommit is less popular but seems to have more features and a more active community than AI Commit so this is the tool I chose to use.

OpenCommit repository on GitHub

Installation

To get started with either tool, all you have to do is install them globally via NPM:

npm i -g opencommit

and add your OpenAI API key

opencommit config set OPENAI_API_KEY=<your_api_key>

Once the key is added all you have to do is run the suggested command and watch the magic happen.

Example commit message generated by OpenCommit

This can save developers precious time and help ensure that commit messages are informative, consistent and understandable.

Pricing

Using OpenAI’s got model is not free, but it’s really cheap, and the benefits far outweigh the cost. I think it takes around 20–30 commit messages to hit 1¢, and if you’re from the UK that’s honestly nothing for the value you get.

Image of amount author has spent on commit messages using the openAI api

In conclusion, writing commit messages with AI is a game-changer for developers. By using tools like AI Commits and OpenCommit, developers can save time and ensure that their messages are informative and concise. With the power of machine learning and deep learning algorithms, writing great commit messages has never been easier.

About the author

Thanks for reading this, I really appreciate you giving my words your time. You can find me on most social media platforms. You can support me by engaging with any of my content or buying me a coffee.

Until next time 👋

--

--

Richard Oliver Bray

Co-founder of orva.studio. Building digital products and teaching others to do the same. Saved by grace.