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

Find and Fix Problems in Your Code
Find and Fix Problems in Your Code
How AI Assistant can help you to understand errors in your code.
Explain Code with AI Assistant
Explain Code with AI Assistant
How AI Assistant can help you understand code
Full Line Code Completion in JetBrains IDEs, All You Need to Know
Full Line Code Completion in JetBrains IDEs, All You Need to Know
What is full line code completion is, how does it work, what languages are supported, and how can you get started