写得好 git 提交信息

编写好 git 提交信息

提交信息

我们作出答复,更改将提交相关信息,这些信息通常被认为是重要的信息会小心留下应该离开,你为什么需要这个提交实例,提交解决任何问题。

我们需要良好的信息组织,虽然后来,由于这些跟代码一样重要。他们是历史,就像课本一样,一旦留下错误的信息或者难以理解的信息。将会对

后来者,产生许多的麻烦。

提交信息规范

一般来说,提交信息没有什么强制性的规范,可是希望大家遵循一些主要的规则,这些规则有利于大家正确表达提交内容,留下重要的信息。而忽略那些不必要

的内容。

实例

https://github.com/torvalds/subsurface

编写一个良好的提交信息:

Also, please write good git commit messages. A good commit message
looks like this:
 
Header line: explain the commit in one line (use the imperative)
 
Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.
 
The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
74 characters or so. That way "git log" will show things
nicely even when it's indented.
 
Make sure you explain your solution and why you're doing what you're
doing, as opposed to describing what you're doing. Reviewers and your
future self can read the patch, but might not understand why a
particular solution was implemented.
 
Reported-by: whoever-reported-it
Signed-off-by: Your Name <youremail@yourhost.com>
 
where that header line really should be meaningful, and really should be
just one line. That header line is what is shown by tools like gitk and
shortlog, and should summarize the change in one readable line of text,
independently of the longer explanation. Please use verbs in the
imperative in the commit message, as in "Fix bug that...", "Add
file/feature ...", or "Make Subsurface..."
 

一次良好的提交信息应该包括一个信息头,尽量用一行文字总结那些必要信息

然后空下一行。

接着写下关于这次提交的详细内容。有关修复bug的背景等等,尽量表达你为什么

要做这次提交而不是你正在作什么提交。这样被人才干非常好的理解而不会弄不清楚

为什么须要这个东西。

全部的提交内容保持在74个字符之内,这样才干被 git log

正常的显示。而不会超过屏幕。

以下是一些: 提交者信息,或者其它信息,一般都是 git 里面须要的代码编写者或者

測试者名字和邮箱。详细參考 git 。

版权声明:本文博客原创文章。博客,未经同意,不得转载。

上一篇:git提交时支持文件名大小写的修改


下一篇:node基础12:动态网页