Commit message formatting: chez Modulotech

Alfred
moduloTech
Published in
3 min readAug 24, 2020

The ability to work on multiple projects with different team members have always been the strong suite of people at Modulotech. Over the years we have been successful in sharing our knowledge with everyone and every project, as we have multiple contributors working towards the same goal. The journey towards this goal is not yet achieved, as the journey never ends.

Here, I would explain a small change in our big journey, our transformation from an unformatted git message to a better solution.

Photo by Yancy Min on Unsplash

Every change is treated as a magic trick. We are the magicians and the audience.

Every magic trick consists of three parts, or acts.
The first part is called the pledge, the magician shows you something ordinary.
The second act is called the turn, the magician takes the ordinary something and makes it into something extraordinary.
But you wouldn’t clap yet, because making something disappear isn’t enough. You have to bring it BACK.
Because making something disappear isn’t enough; you have to bring it back. That’s why every magic trick has a third act, the hardest part, the part we call “The Prestige

- The Prestige (2006)

The Pledge

We have taken our git commit message as the property for our magic trick.
We took the examples of our previous commit messages and we displayed it to the team, to show them the ordinary.

The Turn

We decided to follow a common guideline to make it better. We started working with commit templates. We wanted to make use of Local Hooks to make our developers follow our guidelines and to have a uniform pattern across our projects. Doing this is difficult as it is slow and time consuming, but the outcome is extra-ordinary as everyone slowly follows the process and they hardly notice it.

Git commit messages are structure in a format to support clarity on commit and to facilitate auto-generation of Changelog in certain environments. They also make it much easier for companies to make their developers to follow a certain guidelines.

Our first step was to come up with a format for a proper git commit message. After investigating briefly, we decided on the format below. Every commit messsage has to have a `<type>` and a `<subject>`. The `<description>`was optional but a good practise to use it.

Commit message template

We integrated this template to our git GUI (Git-kraken, SourceTree, Fork etc,.), thus enforcing the template as a reference whenever a new commit is about to happen.

The second step was to make sure it is being followed. So we decided to use git local hooks. To start our transformation, we started with the `prepare-commit-msg` hook. We kept it simple so there are no complexities involved. We edited the `prepare-commit-msg`hook at .git/hooks

prepare-commit-msg

The Prestige

We have successfully made the transformation to our templated format. To conclude the magic trick, we can now successfully auto-generate changelog/release-notes based purely on the commit message.

As I said before, the journey never ends, it’s another step for another endeavour.

Our next journey is to make use of the template and to improve the auto-generated changelog to a better version.

--

--