Book Image

Gitlab Cookbook

By : Jeroen van Baarsen
Book Image

Gitlab Cookbook

By: Jeroen van Baarsen

Overview of this book

Table of Contents (16 chapters)
GitLab Cookbook
About the Author
About the Reviewers

How to format a good Git commit message

When writing a commit message, it is important to tell a story. Why did you make this change? What is it trying to solve? This way, people in the future can see exactly what your intentions were.

There are a few rules you can stick to that will make sure you have the best commit message in your team! They are as follows:

  • The first line should contain 50 characters or less and explain the change very briefly.

  • The next paragraph should contain a bit more explanation about what you are trying to solve. Try to keep the length of the line under 72 characters; this way, it's easy to scan people.

  • If you have more information that you want to tell, you can do so in the next paragraph. This can be as long and detailed as you want. More details are better!

  • If you want to create a list, use the or * characters to do so.

  • When you're working on an issue, add a reference to that issue in the last line.

An example of a nicely formatted Git commit message is as follows:

Show an error page if the user is not logged in

When a user is not logged in, we do not show an error message.
This was confusing to some users. We now show the correct error message.

* Here is some extra information
* And here is some more bullet information

Fixes: #1123