【发布时间】:2015-01-23 00:15:55
【问题描述】:
让我们看看 .gitignore 文件 - 我在其中添加了 mllib/pom.xml 和 pom.xml 甚至 .gitignore(这应该不是必需的 - 所以有些不对劲..):
$head .gitignore
.gitignore
mllib/pom.xml
pom.xml
那么让我们看看git要添加哪些文件:
$ git status
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
modified: mllib/pom.xml
modified:
更新 有两个关于不“忽略 .gitignore”的方法。但是在再次删除 .gitignore 之后,我们得到了这个:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
modified: mllib/pom.xml
所以 (a) .gitignore 出现了,并且 (b) 真正重要的特定文件不添加到提交 - mllib/pom.xml - 也 出现了。
【问题讨论】:
-
不要忽略忽略
-
呃……你可能不想忽略
.gitignore。 -
如果我删除 .gitignore 然后它会显示在“未暂存的更改”中
-
那是因为它不是为提交准备的...
-
从
.gitignore中删除.gitignore后,执行git add .。你不会再对那个 XML 文件有任何问题了。