Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
465 views
in Technique[技术] by (71.8m points)

git - .gitignore和.gitkeep有什么区别?(What are the differences between .gitignore and .gitkeep?)

What are the differences between .gitignore and .gitkeep ?

(.gitignore.gitkeep什么.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上找到太多文档。)

  ask by Matty translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

.gitkeep isn't documented, because it's not a feature of Git.

(.gitkeep没有记录,因为它不是Git的一个功能。)

Git cannot add a completely empty directory .

(Git 无法添加一个完全空的目录 。)

People who want to track empty directories in Git have created the convention of putting files called .gitkeep in these directories.

(想要在Git中跟踪空目录的人已经创建了将这些名为.gitkeep文件放在这些目录中的约定。)

The file could be called anything;

(该文件可以被称为任何东西;)

Git assigns no special significance to this name.

(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文件添加到空目录中以跟踪它们,但有些人认为这令人困惑,因为目标是保留空目录,而不是忽略它们;)

.gitignore is also used to list files that should be ignored by Git when looking for untracked files.

(.gitignore还用于列出Git在查找未跟踪文件时应忽略的文件。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...