为什么不建议将Eclipse项目文件夹作为Git存储库? [英] Why is not recommended to have an Eclipse project folder as a Git repository?

查看:88
本文介绍了为什么不建议将Eclipse项目文件夹作为Git存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当共享一个项目作为git并试图将Eclipse项目文件夹作为git仓库时,Eclipse表示不建议这样做,并且它应该在Eclipse工作区之外。



为什么会这样?

解决方案

From Eclipse EGit帮助页面


将项目设置为您的Repository的根文件夹可能不是一个好主意



原因是您永远不会能够将另一个项目添加到此存储库,因为.project文件将占据根文件夹;您仍然可以将项目添加为子文件夹,但是这种项目嵌套已知会导致遍布各处的许多问题。为了添加另一个项目,您必须将项目移动到存储库中的子文件夹,然后将第二个项目添加为另一个子文件夹,然后才能提交此更改。




更多信息


将Eclipse存储在Eclipse之外是一个好主意工作区



有以下几个原因:



新版本库将考虑Eclipse的完整文件夹结构工作区作为(潜在)内容。这会导致性能问题,例如在提交前计算更改(例如,将扫描完整的.metadata文件夹);通常情况下,工作区将包含死文件夹(例如已删除的项目),它们在语义上与EGit无关,但不能轻易排除。元数据(.git - )文件夹将成为Eclipse Workspace的子项。目前还不清楚这是否会导致Eclipse不必要的文件夹遍历。



您可以通过销毁Eclipse Workspace轻松销毁您的Repository



When sharing a project as git and trying to make the Eclipse project folder as the git repository, Eclipse says that it is not recommended to do so and that it should be outside the Eclipse workspace.

Why is that?

解决方案

From Eclipse EGit help pages,

It is probably not a good idea to make a project the root folder of your Repository

The reason is that you will never be able to add another project to this Repository, as the .project file will occupy the root folder; you could still add projects as sub-folders, but this kind of project nesting is known to cause lots of problems all over the place. In order to add another project, you would have to move the project to a sub-folder in the Repository and add the second project as another sub-folder before you could commit this change.

Some more information

It is a good idea to keep your Repository outside of your Eclipse Workspace

There are several reasons for this:

The new Repository will consider the complete folder structure of the Eclipse workspace as (potential) content. This can result in performance issues, for example when calculating the changes before committing (which will scan the complete .metadata folder, for example); more often than not, the workspace will contain dead folders (e.g. deleted projects) which semantically are not relevant for EGit but can not be excluded easily.

The metadata (.git-) folder will be a child of the Eclipse Workspace. It is unclear whether this might cause unwanted folder traversals by Eclipse.

You can easily destroy your Repository by destroying your Eclipse Workspace

这篇关于为什么不建议将Eclipse项目文件夹作为Git存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆