You are a developer, and you started to use Git recently? If you are wondering what the best way to create a good commit message for your project is, then this article is made for you.
After a few weeks without writing new articles, I’m coming back today with the next part of one of my most searched posts on Google.
When I started to write, one year ago, I created an article on how to start and create your first repository with Git.
This article is appreciated by the community and helps many people each week. Thus, the next part of this series will be how to write a good commit message.
As a short reminder, the commit message is the short text you left when you save your work on Git. This message has the specific goal of identifying your work.
Just by reading it, anyone will be able to clearly understand what you did in this part of your work.
Below, you can find an example of the latest commits on GitHub for AngularJS, a popular framework developed by engineers at Google. As you can see, messages are clear, and we can better understand which work has been done in different parts.
For example, on July 24, 2019, “gkalpak” upgraded “SauceConnect” and switched to the last version of Safari (web browser).
Unfortunately, commits do not have a universal way to be written. Each project and each company define specific rules for their needs.
Don’t worry; you will often find similar ways of writing the message.
Although, I highly recommend you to read the rules before starting in a company or working on an open-source project.
I will give you more details on these guidelines later in this article.
I created a short list of the advantages of using a good commit message.
Note: If you are working on a personal project, I highly recommend you to follow specific rules. It will improve your productivity, and if you ask help from another developer, it will be easier for him to start working on your project.
Note: If you want to have more example of bad commits and have fun at the same time, a Twitter account named "gitlost" is tweeting every day with the funny and unfiltered commits.
If you want to write a good commit message, you need to follow some rules. I created a checklist below. Every time you want to commit, take the time to refer to this list.
ADDITIONAL INFORMATION: I want to share with you more details on the 'git commit' command. If you are not using a git software, you should know that you can create detailed commit by typing this command:
$ git commit -m "Title" -m "Description"
It's the same as before, but with a second part for the description. So, "-m 'title' "is to write the short title of the commit, and "-m 'description' "is to write the description if you need to give more details.
➡️ If you want more content like this, you can follow me on Twitter, where I tweet about web development, self-improvement, and my journey as a fullstack developer!