eclipse和git的工作区和repo路径安排 [英] Workspace and repo paths arrangement for eclipse and git

查看:271
本文介绍了eclipse和git的工作区和repo路径安排的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看过类似的问题,但有些已经很老了,有些还不是我正在寻找或没有答案。



我在Eclipse中有项目在 / workspace / project1 / workspace / project2 之下。他们是Gradle项目,彼此依赖。我也有 / workspace / project3 这是一个Gradle项目,但是是独立的。



我需要上传他们到Bitbucket的git repo。我安装了EGit来帮助我。它问我的地方回购所在的地方,我不知道该怎么说。我是否应该为每个工作区或每组依赖项目创建一个备份?或者什么?



例如,当我右键单击项目并按 Team>分享> Git 我进入这个对话框,我不知道我应该填写什么。



)git仓库有一个工作目录,其中当前签出的提交文件(简称 HEAD )存储。



默认情况下,工作目录是git元数据目录(名为 .git ),但可以通过配置分离设置。例如: git config core.worktree / path / to / workdir



EGit无法处理有分离的工作目录如下: EGit工作目录不在本地存储库下



但不管这个限制,你不能在几个工作区之间拆分git仓库的工作目录。


$ b $因此,您应该将项目移动到工作目录以类似于此结构:

 〜/ git / my- repo / .git 
〜/ git / my-repo / project1
〜/ git / my-repo / project2
〜/ git / my-repo / project3

如果 project3 独立于其他人,则可能会保留在位于其他地方。



当计划将相互依赖的项目分布在多个git存储库时,请谨慎。这使得git存储库也有效地相互依赖,但是没有git具有依赖关系管理工具。



要让EGit移动项目,您需要输入



常用的构建文件如master pom.xml或相应的Gradle文件将位于工作目录的根目录中。这也简化了流行的构建服务的配置,如Travis,代码和朋友。


I've seen similar questions but some are very old and some are not quite what I'm looking for or have no answers.

I have projects in Eclipse under /workspace/project1 and /workspace/project2. They are Gradle projects and are dependent on each other. I also have /workspace/project3 which is a Gradle project but independent.

I need to "upload" them to a git repo on Bitbucket. I installed EGit to help me with this. It asks me where my local repo is located and I don't know what to tell it. Should I create a repo per workspace or per group of dependent projects or what?

For example when I right click a project and press Team > Share > Git I get to this dialog and I don't know what I should fill in there.

解决方案

Each (non-bare) git repository has a work directory in which the files of the currently checked out commit (referred to as HEAD) are stored.

By default, the work directory is the parent of the git metadata directory (named .git), but it can be detached through a config setting. For example: git config core.worktree /path/to/workdir

EGit cannot deal with repositories that have a detached work directory as answered here: EGit working directory not under the local repository

But irrespective of this limitation, you cannot split the work directory of a git repository among several workspaces.

Therefore, you should move the projects to the work directory to resemble this structure:

~/git/my-repo/.git
~/git/my-repo/project1
~/git/my-repo/project2
~/git/my-repo/project3

If project3 is independent of the others, it may remain where it is or be located somewhere else entirely.

A word of caution when planning to have interdependent projects spread across several git repositories. This makes the git repositories effectively interdependent as well, but without git having a dependency management tool.

To have EGit move the projects, you would enter project1 in the Path within repository input field.

Commonly used build files like the master pom.xml or corresponding Gradle files would be located in the root of the work directory. This also eases configuration of popular build services like Travis, Codeship and friends.

这篇关于eclipse和git的工作区和repo路径安排的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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