Got Sick of Writing Commit Messages, I Made an LLM Do It for Me
Tired of writing commit messages? I was too, until I created the Ollama Commit Summarizer, an extension that helps you in this tedious task. Discover how this tool analyzes your code changes and generates concise, relevant commit messages, saving you time and maintaining project history consistency.
Writing commit messages is one of those tedious tasks every developer must do, but let's face it—most of us would rather be doing almost anything else. After years of struggling to craft meaningful, succinct commit messages, I finally had enough. That's when I decided to create something to do the job for me: the Ollama Commit Summarizer, an extension that leverages a language model to write commit messages.
The Problem
As any developer will tell you, commit messages are crucial for maintaining a clean and understandable project history. But they can also be a major time sink, especially when you're in "THE zone", and writing that perfect message just feels like an unnecessary interruption. My commit logs were beginning to look like a series of random thoughts hastily jotted down, and it was starting to impact my workflow.
The Idea
The idea hit me during one of those late-night coding sessions when you're just desperate for a breakthrough. I had been experimenting with language models (LLMs) and their capabilities, and it suddenly struck me—why not use one to generate my commit messages? If an LLM could write essays, articles, and even poetry, surely it could handle something as straightforward as a commit message?
The Creation of Ollama Commit Summarizer
With a new sense of purpose, I set out to build the Ollama Commit Summarizer. The extension would analyze the changes made in the code and then generate a concise, relevant commit message. It had to be simple to use, efficient, and most importantly, it had to produce commit messages that made sense.
Built with Kotlin for IntelliJ-based IDEs, this plugin seamlessly integrates into your workflow, providing an automated solution for generating commit messages. You can find the extension on the JetBrains Plugin Marketplace and the source code on GitHub. The core functionality is built around the language models available through the Ollama API. The process is straightforward: once you’ve made your changes, you run the summarizer, and it spits out a commit message based on the modifications in your code.
How It Works
Here's a quick rundown of how Ollama Commit Summarizer works:
- Analyze the Code Changes: The extension get the diffs in your project to understand what changes were made and format it.
- Generate the Commit Message: It sends this information to the language model, which then crafts a commit message that succinctly describes the changes.
- Review and Commit: You get a suggested commit message, which you can review, tweak if necessary, and then commit.
Benefits
Since I started using the Ollama Commit Summarizer, my workflow has improved dramatically. Here are some of the benefits I've noticed:
- Consistency: The commit messages are consistently clear and informative.
- Efficiency: It saves me time, allowing me to focus more on coding and less on writing.
- Ease of Use: It's incredibly easy to integrate and use within my existing workflow.
Conclusion
Creating the Ollama Commit Summarizer has been a game-changer. It not only solved a persistent annoyance but also leveraged the power of language models in a practical, everyday task. If you're a developer who dreads writing commit messages as much as I did, I highly recommend giving it a try. You might just find that your commit logs become the most well-written part of your codebase!
You can check out and contribute to the project on GitHub and get the extension down bellow. Let's make tedious commit messages a thing of the past!