为什么 .gitignore 使用空的基本名称?
Why does .gitignore use an empty basename?
任何时候我在第一次学习 Git 时在 Windows 上看到 .gitignore
file in a Git repository, I can't help but notice that, aside from the file extension, the filename is completely empty. Because of this, I've often seen new programmers run into the "" 错误。
其他标准文件,如 README.md
包含基本名称,因此排除 .gitignore
的名称似乎很奇怪。
.gitignore
的基本名称总是空的是什么原因?如果文件名是 project-name.gitignore
?
,文件还能正常工作吗?
正如评论中其他人所说,文件名前面的点表示 unix/linux 系统中的隐藏文件。
Would the file still work properly if it were given a filename like project-name.gitignore?
不,不会。 Git 仅查找名为 .gitignore
的文件(加上您在配置中定义的全局忽略文件)。
Other standard files such as README.md include basenames, so it seems odd to exclude the name for .gitignore.
README.md 不是 Git 中的标准文件,它是许多托管服务提供商使用的文件。标准 git 文件,例如 .gitignore
和 .gitattributes
具有一致的命名约定。
任何时候我在第一次学习 Git 时在 Windows 上看到 .gitignore
file in a Git repository, I can't help but notice that, aside from the file extension, the filename is completely empty. Because of this, I've often seen new programmers run into the "
其他标准文件,如 README.md
包含基本名称,因此排除 .gitignore
的名称似乎很奇怪。
.gitignore
的基本名称总是空的是什么原因?如果文件名是 project-name.gitignore
?
正如评论中其他人所说,文件名前面的点表示 unix/linux 系统中的隐藏文件。
Would the file still work properly if it were given a filename like project-name.gitignore?
不,不会。 Git 仅查找名为 .gitignore
的文件(加上您在配置中定义的全局忽略文件)。
Other standard files such as README.md include basenames, so it seems odd to exclude the name for .gitignore.
README.md 不是 Git 中的标准文件,它是许多托管服务提供商使用的文件。标准 git 文件,例如 .gitignore
和 .gitattributes
具有一致的命名约定。