让我们来看一下 .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
。 - user554546