简体   繁体   English

不要忽略git sourcetree中的文件

[英]Do not ignore files in git sourcetree

I am downloading an eclipse project from source tree. 我正在从源代码树下载一个eclipse项目。 The .project and .classpath files are not checked in. I want these checked in to do a successful import. 未签入.project和.classpath文件。我希望这些文件已成功导入。 I have no gitignore file. 我没有gitignore文件。 Can anyone shed some light as to why these files aren't coming across? 任何人都可以解释为什么这些文件没有出现?

I also looked on the source machine that checked these files and the files are there. 我还查看了检查这些文件的源机器,文件就在那里。 In the sourcetree version on that machine it doesn't show anymore files to be checked in. 在该计算机上的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

This seems like this isn't the case either. 这似乎不是这种情况。

Thanks! 谢谢!

Either your files have not been committed to the repository, as @adam-dymitruk told you, or you are ignoring them. 您的文件尚未提交到存储库,正如@adam-dymitruk告诉您的那样,或者您忽略了它们。 Run this command: 运行此命令:

$ git config --get core.excludesfile $ git config --get core.excludesfile

And have a look at the file you get. 看看你得到的文件。 You might have some patterns there which exclude your IDE files. 您可能在那里有一些排除IDE文件的模式。 I know that PHPStorm asks you at certain point to exclude theirs files globally. 我知道PHPStorm会在某些时候要求您在全球范围内排除他们的文件。 It might be that somebody (or eclipse) did the same in your source machine. 可能是某人(或eclipse)在你的源机器中做了同样的事情。

Apart from the repo-local .gitignore file, there might be further ignore options specified in the file .git/info/exclude in the repo, or using the config on a global level. 除了repo-local .gitignore文件之外,可能还会在repo中的文件.git/info/exclude中指定进一步忽略选项,或者在全局级别使用config。 You'll probably have to check for these things on the sender's machine, since that's where the files are and don't get checked in. 您可能必须在发件人的计算机上检查这些内容,因为这是文件所在的位置,并且不会签入。

you can see what is not committed or staged yet with 你可以看到未提交或暂停的内容

git status

This should show that those files are not tracked yet. 这应该表明尚未跟踪这些文件。 You can start to track them by adding them to the index: 您可以通过将它们添加到索引来开始跟踪它们:

git add .project

or add all files (not recommended if you don't have a proper .gitignore defined yet): 或添加所有文件(如果您尚未定义正确的.gitignore,则不推荐):

git add .

or 要么

git add -A

if you want to stage deletions as well. 如果你想要删除也是如此。

The other thing that could be happening here is that you are simply not seeing that the .project file is there. 这里可能发生的另一件事是你根本没有看到.project文件存在。 OSes usually hide these by default. 操作系统通常默认隐藏它们。 Use 采用

ls -A

to include these types of files in the directory listing. 在目录列表中包含这些类型的文件。 To see the contents of what git stored in the last commit, you can also use 要查看上次提交中存储的git的内容,您也可以使用

git ls-tree HEAD

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM