3

There is some variation in the exact numbers but in general there are recommended lengths or maximum lengths for the first and subsequent line lengths of commit messages. The common one seems to be at most 72 characters for a message body with a further suggested limit of 50.

What are the reasons for these or other commonly encountered git commit line limits?

I have heard that the 72 character limit is related to the recommended email width limit of 76 as defined in RFC 2045:

(5) (Soft Line Breaks) The Quoted-Printable encoding REQUIRES that encoded lines be no more than 76 characters long.

There is something about a git function adding 4 characters to the commit message when generating an email, which would require the commit line to be shorter than the email limit. In turn I am aware that the email character limit is related to the ~80 character limit of old terminal systems.

If that does explain the 72 character limit, where does the 50 character one come from? Subject: is only 9 characters so adding that before 50 would only give 59. Maybe we then add the commonly used 7 character abbreviated commit hash ID and a space which gives us 67, still 5 spare characters to go.

TafT
  • 1,786
  • 2
  • 22
  • 41
  • 3
    Possible duplicate of [Git Commit Messages : 50/72 Formatting](http://stackoverflow.com/questions/2290016/git-commit-messages-50-72-formatting) – e.doroskevic Aug 11 '16 at 09:05
  • @e.doroskevic I agree that my question is similar to one of the 3 parts posed by the suggested duplicate. However that question and the resulting answers seem to focus more on the prevalence of the 50/72 Style, who uses or supports is and what are the popular alternatives. My question is more specific in wanting a justification for the 50/72 style, or at least a historic explanation for its existence. The answer that references [Tim Pope's blog post](http://www.tpope.net/node/106) does come close to answering my question but lacks some of the requested details about the exact numbers. – TafT Sep 23 '16 at 09:17

1 Answers1

2

The 50 character limit for summaries is not a hard limit. But you should strive to find a good short summary for your commits. So aiming for a maximum of 50 characters is a good practice to achieve this.

I think the body limit of 72 characters has with the good old 80 character per line limit. The linux kernel coding style among many other projects use this.

The reason it's 72 and not 80 is because git might add some indentation to the body of a git message, and it will still be 80 or less characters.

crea1
  • 7,749
  • 3
  • 32
  • 39