分离呈现和数据的方式驱动我的提交消息。
您的提交消息不应在任何字符计数处断行,而是应使用换行符作为数据的一部分来分隔思想、段落等,而不是用于呈现。在这种情况下,“数据”是您想要传达的信息,“呈现”是用户看到的方式。
我在顶部使用单个摘要行,并尽量保持简短,但我不限制自己的行数。如果Git实际上提供了一种将摘要消息存储为与消息本身不同的实体的方式,那会好得多,但由于它没有提供,我必须进行一些修改,使用第一个换行符作为分隔符(幸运的是,许多工具支持这种数据分割方法)。
对于消息本身,换行符表示数据中的某些有意义的部分。单个换行符表示列表中的开始/断点,双倍换行符表示新的思想/想法。
This is a summary line, try to keep it short and end with a line break.
This is a thought, perhaps an explanation of what I have done in human readable format. It may be complex and long consisting of several sentences that describe my work in essay format. It is not up to me to decide now (at author time) how the user is going to consume this data.
Two line breaks separate these two thoughts. The user may be reading this on a phone or a wide screen monitor. Have you ever tried to read 72 character wrapped text on a device that only displays 60 characters across? It is a truly painful experience. Also, the opening sentence of this paragraph (assuming essay style format) should be an intro into the paragraph so if a tool chooses it may want to not auto-wrap and let you just see the start of each paragraph. Again, it is up to the presentation tool not me (a random author at some point in history) to try to force my particular formatting down everyone else's throat.
Just as an example, here is a list of points:
* Point 1.
* Point 2.
* Point 3.
这是软件自动换行的阅读视图。
这是一个摘要,请尽量保持简短,并以换行符结束。
这是一种思考方式,也许是对我所做的事情的解释,以人类可读的格式呈现。它可能很复杂,由几个句子组成,以文章形式描述我的工作。在作者撰写时,我不能决定用户将如何消耗这些数据。
这两个想法之间有两个换行符。用户可能会在手机或宽屏幕显示器上阅读此内容。您是否曾经尝试阅读72个字符包装的文本,而您的设备只能显示60个字符?这是一种真正痛苦的体验。此外,本段开头的句子(假设采用文章风格格式)应该是段落的介绍,因此如果工具选择不自动换行,则可以让您仅查看每个段落的开头。同样,强制将我的特定格式强加给其他人并不取决于我(某个历史时期的随意作者),而取决于演示工具。
仅作为示例,以下是一些要点:
* 要点1。
* 要点2。
* 要点3。
我怀疑您所链接的Git提交消息建议的作者以前从未写过将被不同设备的广泛用户消耗的软件(例如网站),因为在软件/计算机的演变到现在这个阶段,众所周知使用硬编码的演示信息存储数据是一个坏主意,因为这会影响用户体验。