.gitignore和.gitkeep有什么区别? [英] What are the differences between .gitignore and .gitkeep?
问题描述
.gitignore
和 .gitkeep
之间有什么区别?它们是不同的名称,还是它们都有不同的功能?我似乎无法在 .gitkeep
中找到很多文档。
What are the differences between .gitignore
and .gitkeep
? Are they the same thing with a different name, or do they both serve a different function? I don't seem to be able to find much documentation on .gitkeep
.
推荐答案
.gitkeep
没有记录,因为它不是Git的功能。
.gitkeep
isn’t documented, because it’s not a feature of Git.
Git 无法添加完全空白的目录。想要跟踪Git中空目录的人已经创建了在这些目录中放置称为 .gitkeep
的文件的约定。该文件可以被称为任何东西; Git并没有为这个名字赋予特别的意义。
Git cannot add a completely empty directory. People who want to track empty directories in Git have created the convention of putting files called .gitkeep
in these directories. The file could be called anything; Git assigns no special significance to this name.
有一个竞争性的约定,将 .gitignore
文件添加到空目录让他们跟踪,但有些人认为这是令人困惑的,因为目标是保留空目录,而不是忽略它们; .gitignore
也用于列出在查找未跟踪文件时应由Git忽略的文件。
There is a competing convention of adding a .gitignore
file to the empty directories to get them tracked, but some people see this as confusing since the goal is to keep the empty directories, not ignore them; .gitignore
is also used to list files that should be ignored by Git when looking for untracked files.
这篇关于.gitignore和.gitkeep有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!