.NET Tools
Essential productivity kit for .NET and game developers
Use JetBrains AI Assistant To Help You Understand Changes In Your Code
You’ll spend most of your time reading and understanding a codebase as a software developer. Reading and comprehending a rapidly evolving codebase may feel overwhelming, especially in situations with limited access to original authors and outdated documentation. Luckily, code never lies, and with the growing capabilities of LLMs and AI Assistants to parse and summarize input, we can start to focus our understanding of prior work and make plans to extend or modify a codebase.
In this post, we’ll see how to use JetBrains AI Assistant to summarize past commits in a Git repository, refine the summary to contributors, and further our understanding of a contributor’s work within a symbol. Finally, you’ll get a few more prompt suggestions to try for yourself.
Before starting, you’ll need the JetBrains AI Assistant plug-in enabled and a valid subscription to the JetBrains AI Assistant service.
Summarizing Commits with JetBrains AI Assistant
JetBrains IDEs have a world-class source control client that can view all branches and commits within an existing repository. If you’ve worked with the JetBrains toolset, you’re likely familiar with the Git Tool Window and navigating an existing codebase. You can highlight several commits when AI Assistant is enabled and choose the “Explain Commits with AI Assistant” option.
This will create a new AI Assistant chat with the selected commits given as context. It’s important to note that AI Assistant will only send the Git commits and their log information to the JetBrains service. AI Assistant does not send the files themselves, but locally, it may display the contents of a referenced file for further insights.
As you’ll note in the screenshot, we get a summary of all the code changes within the selected commits. We can further refine the chat to exclude the work we did. In this case, I’ve typed “Summarize all the work by everyone except Khalid Abuhakmeh” to the existing chat.
Change the name in the prompt to match your name to test it with your existing codebase. You can choose to save this prompt to be used in future chats to accelerate your workflow further.
Another valuable approach would be to group the summary by contributors using the prompt “Group all summaries by contributors”.
You may see symbols of interest as you read the chat response. These are great opportunities to refine the explanation of a particular symbol further. Since I’m working with the HTMX.NET codebase, I want to see all the changes affecting the HtmxHeadersTagHelperTests class with the prompt “What work did Ricky do in HtmxHeadersTagHelperTests“.
Other ideas to further refine your AI Assistant summary might include:
- What work was performed within JavaScript files?
- Who made the most changes within these commits?
- How many test files are within these commits?
- Did any two contributors work on the same file within these commits?
- How many commits were there, excluding merge commits?
- Give me the selected commit history in a CSV format using only commas and quoted values.
These are helpful prompts that can help enlighten you and provide you with a means of sharing the information with others within your development team. As a note, always double-check the responses for accuracy and completeness.
Conclusion
JetBrains AI Assistant can help you discover, organize, and formulate thoughts about the work you and others have already done within an existing codebase. With this understanding, you can better process and effectively communicate ideas to team members. Effective dialogue can improve team efficiency, discover and eliminate bugs, and improve software.
This post has given you a few ideas to try with JetBrains AI Assistant when discovering the work already found in your codebase. Now’s a perfect time to try out JetBrains AI Assistant; there is a 7-day trial for new users. For existing users, we’d love to hear your ideas about other prompts you use in your daily workflow.