我有一个.gitignore文件,其中包括
index.php
protected/config/
我想忽略根目录下的index.php文件,但git也会忽略所有子文件夹中名为index.php的文件。 我该如何修改.gitignore文件仅忽略特定的index.php文件而不是所有名称为index.php的文件?
我有一个.gitignore文件,其中包括
index.php
protected/config/
在你的 .gitignore
中使用 /index.php
/index.php
只会匹配根目录下的 index.php
文件。如果路径中不包含任何斜杠,则匹配文件名,因此 index.php
将匹配任何深度下命名为 index.php
的文件。 - Lily Ballard/index.php
,但是我对根路径下的此文件所做的任何更改仍然被跟踪。 - Camilo Lizarazo