初始/第一个git提交内容的约定是什么?

and*_*ies 16 git

我知道应该为每个逻辑更改提供Git提交,但第一次提交的约定是什么(如果存在)?

[注意:我不是就这个问题征求意见/讨论 - 如果没有共同的约定那就好了].

例如,我从头开始使用index.html创建一个网站 - 我的第一个"逻辑更改"提交可以是添加<head>元素,添加HTML结构或添加基本内容和CSS.或者第一次提交应该是第一个"工作"版本?

编辑:我不是指提交消息; 我的意思是文件的内容.

Cod*_*ard 24

通常,第一个提交名为"初始提交".

作为最佳实践,它包括README描述项目的文件.
README通常是一个MD文件.

只是为了好玩,请阅读: 有趣的初始git提交消息:


lmi*_*asf 10

As others have reported, I haven't found a standard convention, so next I will share what I usually do.

After creating the repo, I create an empty commit which message is Initial empty commit. You have to pass the option --allow-empty. Otherwise, you will get a message saying nothing to commit.

$ git init # creates repository
$ git commit --allow-empty -m'Initial empty commit' # creates empty commit
Run Code Online (Sandbox Code Playgroud)

I like to do it this way because it makes me think of this commit as the empty root of my repository. Besides, I can immediately push this repository without any content. After this commit I usually add the README.md.


and*_*ies 9

似乎没有既定的约定(对于内容;而不是消息).

我发现这篇关于最佳实践的文章很有用:https://sethrobertson.github.io/GitBestPractices/