Great git commit messages
How to make writing clear commit messages easy.
Lately I read this great post on how to structure git commit messages so they are useful, clear and easy to read. But I really don’t want to find the post every time I commit, now do I?
For VSCode users
The projects I worked on after reading the post were mostly in Flutter. I program them using VSCode. There has to be a simple plugin for writing commit messages, right?
Right! This sweet extension was perfect for me. I chose the “form” option, which shows exactly what to fill where, including a dropdown for the various types with explanations on each one. Perfect!

Look at those lovely messages:

But: It doesn’t work with git submodules (it seemed to reference the wrong repo). Also, in the past few weeks I programmed also in Unity, Android Studio and STM32CubeIDE (don’t ask). I usually use Git Bash. So how to make git bash commits better?
Git Bash
The solution is using a git template. This opens the template each time you commit, providing you don’t use the “-m” option.
First, if you haven’t done so yet, setup your default message editor (I use vscode). Github has a list of many options here.
$ git config --global core.editor "code --wait"
Then create your template file (a great example is here). It can be anywhere you want. I put it in my projects folder: c/projects/gitmessage.txt
# Title: type(scope) description
# No more than 50 chars. #### 50 chars is here:##### Types: fix(bug),feat(ure),perf(ormance),refactor,build,ci,docs,style,test# Remember blank line between title and body.
# Body: Explain *what* and *why* (not *how*).
# Wrap at 72 chars. ################################## which is here: ### One more blank line# Footer: fix/see also #123
Then you need to tell git to use it as a template:
git config — global commit.template /c/projects/gitmessage.txt
And remember to commit without the -m option:
git commit -a
or
git commit

And you’re done!