Oh Dear is the all-in-one monitoring tool for your entire website. We monitor uptime, SSL certificates, broken links, scheduled tasks and more. You'll get a notifications for us when something's wrong. All that paired with a developer friendly API and kick-ass documentation. O, and you'll also be able to create a public status page under a minute. Start monitoring using our free trial now.

Saying goodbye to WIP commit messages

Original – by Freek Van der Herten – 5 minute read

There are two kinds of developers: those that write commit messages and value a repo's history and those that don't. I'm in the latter camp: most of my commit messages just read "WIP", much to the chagrin of some of my colleagues. I've tried to change my ways, but I just can't get into the habit of writing good commit messages.

But now I have a solution: I use the power of AI to write my commit messages for me. In this blog post, I'll show you how I did it.

My commit function

In my dotfiles, you'll find that I this little simple function to commit my changes:

function commit() {

   if [ "$commitMessage" = "" ]; then

   git add .
   eval "git commit -a -m '${commitMessage}'"

So if I don't pass a commit message, "wip" will be used as the commit message. Here's how it can be used:

commit "Add new feature" # will commit with the message "Add new feature"
commit # will commit with the message "wip"

Updating the commit function to use AI

These past few months, AI seems to be everywhere. So I thought: why not use AI to write my commit messages for me? I was not the first one to have this idea. If you Google around a bit, you'll find lots of tools on GitHub that use AI to generate commit messages. I decided to use this one.

I updated my commit function to use this tool:

function commit() {

   git add .

   if [ "$commitMessage" = "" ]; then
   eval "git commit -a -m '${commitMessage}'"

If I don't pass a commit message now, the aicommits command will generate a commit message. But I still have the option to pass a commit message myself.

Let's see it in action. Here's a screenshot of using my commit command to commit the updated email address in the Mail::to function.

Granted, this was a straightforward code change, but you can see that the generated message "Update recipient email address in SendTestMailCommand" is far better than the "wip" message I would have used otherwise.

I've been using aicommits for a few days now, and it seems to generate a good message for more complex changes.

Looking closely at the screenshot above, you'll see I had to confirm using the generated commit message. Should the generated message not be good enough, I can just type a new message, and the commit will be made with that message.

How aicommits works under the hood

You might think that aicommits is some kind of magic, but it's actually quite simple. I'm sure many of you have already used ChatGPT. The aicommits tool does something very similar. Instead of you manually typing a message in ChatGPT, aicommits uses the API to ask a question to the AI.

In the source code of aicommits, you'll find the code to generate the prompt (the question sent to the AI) that is used:

const getPrompt = (
 locale: string,
 diff: string,
 maxLength: number,
) => `${[
 'Generate a concise git commit message written in present tense for the following code diff with the given specifications.',
 `Message language: ${locale}`,
 `Max message character length: ${maxLength}`,
 'Exclude anything unnecessary such as the original translation—your entire response will be passed directly into git commit.',

That diff variable is simply filled by the output of the git diff command. So, in the end, the prompt that is sent to the AI looks something like this:

Generate a concise git commit message written in present tense for the following code diff with the given specifications. 
Message language: en-US 
Max message character length: 72 
Exclude anything unnecessary such as the original translation—your entire response will be passed directly into git commit. 

<git diff output>

And believe it or not, the AI is able to generate a good commit message based on that prompt. Most simple AI tools like aicommits work in a similar fashion. The AI solution that are coming in Flare, are also based on this principle.

In closing

I'm very happy with this little change to my workflow. I'm now able to write good commit messages, without having to change my habits. I'm sure some of my colleagues are happy with this change as well. Take a look at this screenshot from our Slack channel.

Be aware that for excellent commit messages you should describe the intent, and not necessary the changes. So, in the example above, instead of "Update recipient email address in SendTestMailCommand", an even better message would be "Send test mail to the correct email address". But let's not expect too much from AI just yet.

If you want to try aicommits out yourself, you can find the updated commit function here in my dotfiles.

Stay up to date with all things Laravel, PHP, and JavaScript.

You can follow me on these platforms:

On all these platforms, regularly share programming tips, and what I myself have learned in ongoing projects.

Every month I send out a newsletter containing lots of interesting stuff for the modern PHP developer.

Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.

Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.


Eugene van der Merwe avatar
Eugene van der Merwe

This looks incredibly useful! I see it's an NPM package, would it be feasible to use this when programming outside of Javascript / Laravel, e.g. doing something in Rust? Or is there some global way to make this work for all projects?

Any advice will be appreciated.

Edit: Scrap that, I see it's a global NPM install :-)

shakirasmith avatar

Because it enables you to communicate and work with your team, producing effectively engaging information is an extremely valuable ability to learn. The place that is used for alterations is the commit. They could develop into a prehistoric document that helps us interpret the past and make wise judgments about the times to come. Online Class Help

Eugene van der Merwe avatar
Eugene van der Merwe

Reporting SPAM.

Yehuda Katz avatar

I what call what the AI generated a "commit summary", not a commit message - even if you write a good commit message, there is still space for a good commit summary. The downside of this is you are sending your code to an outside service you don't have any control over, so if you do this, you need to make sure you aren't sending anything sensitive and, if applicable, your company policy allows it.

Comments powered by Laravel Comments
Want to join the conversation? Log in or create an account to post a comment.