不要忽略git sourcetree中的文件

不要忽略git sourcetree中的文件,git,version-control,gitignore,atlassian-sourcetree,Git,Version Control,Gitignore,Atlassian Sourcetree,我正在从源代码树下载一个eclipse项目。.project和.classpath文件未签入。我希望这些文件签入以成功导入。我没有gitignore文件。有人能解释一下为什么这些文件没有被发现吗 我还查看了检查这些文件的源计算机,这些文件都在那里。在该计算机上的sourcetree版本中,不再显示要签入的文件 My exlude file looks like this: # git ls-files --others --exclude-from=.git/info/exclude # Lin

我正在从源代码树下载一个eclipse项目。.project和.classpath文件未签入。我希望这些文件签入以成功导入。我没有gitignore文件。有人能解释一下为什么这些文件没有被发现吗

我还查看了检查这些文件的源计算机,这些文件都在那里。在该计算机上的sourcetree版本中,不再显示要签入的文件

My exlude file looks like this:
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
.DS_Store
看来情况也不是这样


谢谢

除了repo local
.gitignore
文件之外,repo中的文件
.git/info/exclude
中可能还指定了其他忽略选项,或者在全局级别上使用配置。您可能必须在发件人的计算机上检查这些内容,因为文件就在那里,不会被签入。

您可以看到哪些内容尚未提交或暂存

My exlude file looks like this:
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
.DS_Store
git status
这应该表明这些文件还没有被跟踪。您可以通过将它们添加到索引开始跟踪它们:

git add .project
或添加所有文件(如果尚未定义正确的.gitignore,则不建议):

如果您也想进行阶段性删除

这里可能发生的另一件事是,您根本看不到.project文件在那里。默认情况下,操作系统通常会隐藏这些内容。使用

ls -A
在目录列表中包含这些类型的文件。要查看上次提交时git存储的内容,还可以使用

git ls-tree HEAD

要么你的文件没有像@adam dymitruk告诉你的那样提交到存储库,要么你正在忽略它们。运行以下命令:

$git config--获取core.excludesfile


看看你得到的文件。您可能有一些排除IDE文件的模式。我知道PHPStorm会在某个时刻要求您全局排除他们的文件。可能是有人(或eclipse)在您的源计算机中做了相同的操作。

我添加了排除文件的内容。
git ls-tree HEAD