How To Write a Good Git Commit Message

Why is a good commit message important?  Good communication about what was changed and why reduces the work involved in coming up to speed on a piece of code.  

We recommend reading Chris Beams' great page on how to write a commit message.  Each summary here is a link back to Chris' full description.

The body of the commit message is optional, but it's important to write a good subject line.


Writing the Subject Line

Limit the subject line to 50 characters

It's worth taking the time to keep it from being truncated.

Capitalize the subject line

This makes it clear that it's a subject line.

Do not end the subject line with a period

Save the space.

Use the imperative mood in the subject line

Git convention.  This summary is written in the imperative.


Writing the Body of the Message

Separate the subject line from the body with a blank line

If the subject and body are contiguous, tools such as log won't be able to distinguish them.

Wrap the body at 72 characters

This allows a little space for indenting.

Use the body to explain what and why, not how

The code itself will explain how.  If the code is too complex for that, it should have good commenting that does the job of explaining how.



OSS Site Map

Developer Guide Pages