This is the second part of my last blog post and in this one let’s talk about commit messages. Commit messages are important means of communication between team members and for the lifecycle of the teams and projects since they include the context in which they were created. By inspecting the project history we can find out why some decisions were made when they were made.
I started to write good commit messages since I started contributing to Sustainable Educational Foundation — SEF in late 2019. For those who don’t know about SEF please make sure to visit our site to know more details. In a nutshell, At SEF, we have something in store for everyone especially you are a student, expert, or a volunteer. After starting contributing to SEF I realised the importance of a good commit message and today I’m going to share those qualities with you.
Without talking too much let’s get to key points that make a commit message great.
Begin all subject lines with a capital letter.
Update the example page
update the example page
This length ensures that they are readable. GitHub’s UI is fully aware of these conventions. It will warn you if you go past the 50 character limit and will truncate any subject line longer than 72 characters with an ellipsis.
Bug fixed in the example page
Hi, everyone, I have good news for you. I just fixed the bug in the example page. blah blah blah
Trailing punctuation is unnecessary in subject lines. Also when you’re trying to keep them to 50 chars or less, Space is more important.
Remove unnecessary imports
Remove unnecessary imports.
It is useful in many scenarios (e.g. multiple commits, several changes, and refactors) to help reviewers understand what the committer was thinking.
Add
use method to Credit model
Add
use method
If the commit message has both subject and body. It is good to separate those two with a blank line. It is useful when checking the git log.
Update the github link
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras blandit varius varius. Nunc vulputate ac urna ac rutrum. Etiam tincidunt et nunc eget pretium. Morbi sed tempus augue. Duis sollicitudin lectus ac aliquet varius.
#gitlab #git #github #2020 #hacktoberfest