Writing quality commit messages is what distinguishes the level of professionalism of an engineering team. As Quality commit messages ease collaboration and code maintenance.
Have you been writing quality commit messages?
Check and review some if not all your commit message by running this command on your git bash console or Terminal
Are you proud of what you have been writing?
Now take time and read this article to understand tips for writing professional git commit messages that tech novices can comfortably understand and derive a report out of it.
This article, assumes you have a basic for git workflow. If this is your first encounter kindly read
- Thou shall not write commit messages in the past tense One of the most emphasized rules for writing commit message is to ensure both the body and subject are not written in the past tense. Instead, use the present tense Example
git commit -m 'Fixed button colour'
git commit -m 'Fix: Change of button colour'
For the benefit of the maintainer, it is advised not to write a movie script with characters. Instead, write a clear commit subject and body. With a maximum of 50 characters.
In big projects, there are systematic reporting channels where every bug has an id. The Id is referred to the issue registered on GitHub. Therefore including this id would make it easy to track the issue.
git commit -m "#5:improve lazy loading"
Specifying the type of commit makes it
feat: The new feature you're adding to a particular application
fix: A bug fix
style: Feature and updates related to styling
refactor: Refactoring a specific section of the code base
test: Everything related to testing
docs: Everything related to documentation
chore: Regular code maintenance. Example
git commit -m "feat:A bug fix"
Writing a commit message with both body and subject will provide excellent documentation to other team members.
For those in a Debian environment, just type
git commit -a
and Vim editor will be prompted. Write the Subject and body into different lines, save and push to the remote repository.
Avoid adding unnecessary punctuation such as question marks, apostrophes and semi-colon. Don't create suspense in your colleague's mind. Just be clear
Rules are there to be broken. However, this is not the case in the software engineering world. Instead, rules are set to harmonize the team during the development and maintenance period. Respect them at all costs, as it is expensive to break them.
You can also use emojis to represent commit types. In visual Code, install the Gitmoji extension