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...