Create and Understand Commit Messages with AI Assistant

How AI Assistant can both generate a commit message and help you understand prior commit messages.

The Problem

You’ve been working on this branch for hours and the time has come to check it into version control! Except... You can’t remember what you had for lunch, and you certainly can’t remember all your changes!

You could go through each file and refresh your memory, and to remind yourself of the big picture, but it doesn’t really help you to craft a good commit message that summarises everything.

The Solution

Let’s see how JetBrains AI Assistant can help us here. Open the Commit tool window ⌘0 (macOS) / Alt+0 (Windows/Linux) - Show Commit tool window and click the AI Assistant icon:

generate-commit-message.png

AI Assistant will generate a commit message for you:

generate-commit-finished.png

You can tailor the prompt, for example, to create a more succinct commit message if you prefer:

tailor-prompt.png

AI Assistant will now give you a shorter commit message according to the prompt:

generate-commit-new-prompt.png

What about the other way around? Understanding someone else’s commits. You can open the Version Control tool window with ⌘9 (macOS) / Alt+9 (Windows/Linux) and find the commit that makes no sense then right-click and ask JetBrains AI Assistant to explain it:

explain-commit.png

JetBrains AI Assistant will give you a summary of the commit:

explain-commit-finished.png

Of course, most of us don’t do one monster commit, we are sensible and do lots of small commit. In this case we can select all the sequential commits that we're interested in and then again, ask JetBrains AI Assistant to explain them:

explain-multiple-commits.png

This time we get an answer that covers all the commits:

explain-multiple-commits-finished.png

So next time you want a bit of help writing your commit message or understanding someone else’s commits, look for the JetBrains AI Assistant icon and just ask!


Related Resources

AI Assistant: Don’t Code Alone
AI Assistant: Don’t Code Alone
Let's look at using JetBrains AI Assistant in quasi-real-world development situations.
Command in chat
Command in chat
Use predefined command in chat.
Inline code completion
Inline code completion
Let AI Assistant write code for you, using inline code completion.