Git - 当我提交时,颜色意味着什么? [英] Git - Do colours mean something in vi when I commit?
问题描述
我在Windows上使用Git Bash,当我运行 git commit
时,vi编辑器打开,允许我编写一个Commit提示。我注意到我写的文本的第一行是黄色(尽管不是全部,只有前30或40个字符),第二行是红色背景上的白色,第三行是灰色。这种颜色编码是否意味着什么,还是仅仅是某种奇怪的小故障?我来自SVN背景,其中提交评论是纯文本,我并不期待这个彩虹。 :)
预先感谢您的回答。
给你一个关于正确格式化你的提交信息的提示。
虽然没有特定的强制执行一种消息风格wrt另一个,传统上Git提交消息的结构如下:
- 描述变更集的简短标题(通常少于50-60个字符);
- 一个空白行;
- 提交的更完整描述,可选地用段落和其他空行分开。
- 一个空白行;
最后一段通常用于元数据条目,如签名关闭:
。
<因此,在你的情况下,Vi可能会警告你,第一行比平常长一点,并且你没有留下空行(我说可能,因为我没有使用Vi,所以我是不确定)。
I'm using Git Bash on Windows and, when I run git commit
, the vi editor opens to allow me writing a Commit note. I noticed that the first row of the text I write is yellow (although not all of it, only the first 30 or 40 characters), the second is white on a red background and from the 3rd onwards they are gray. Does this colour coding mean anything, or is it just some sort of weird glitch? I come from an SVN background, where Commit comment was pure text and I wasn't expecting this "rainbow". :)
Thanks in advance for the answers.
Vi is giving you a hint about "properly" formatting your commit message.
While there is no specific enforcement of one message style w.r.t. another, "traditionally" Git commit messages are structured this way:
- A short title describing the changeset (usually less than 50-60 characters);
- One blank line;
- A more complete description of the commit, optionally divided in paragraphs with other blank lines.
The last paragraph is usually used for "metadata" entries, like Signed-off-by:
.
So, in your case, Vi is probably warning you that the first line is a a little longer than usual and that you did not leave a blank line after it (I say "probably" because I do not use Vi, so I am not sure about it).
这篇关于Git - 当我提交时,颜色意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!