将git项目导入工作区而不使用egit [英] Importing git project into workspace without using egit

查看:122
本文介绍了将git项目导入工作区而不使用egit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几周前我问了一个关于Egit的问题,有人建议我阅读我一直在提及的pro git。
我宁愿在命令行中使用git,并在6月份等待Eclipse Indigo发布版的egit稳定版本,因为存在许多错误,并且会导致我的ide停滞。



因此,为了试用它,我将我的工作目录复制到一个新的位置,创建了一个git repo& init然后添加工作目录中的所有文件。我的想法是我可以控制命令行中的所有git函数,然后在eclipse中使用F5 -refresh,这样任何git操作都会反映到项目中。



首先我不确定这是否是一个很好的解决方法...仍然有很多关于git,eclipse&例如,我不完全明白。



但是我目前的主要绊脚石是我不知道如何从我复制到工作目录中的文件中获取文件在eclipse中的项目,我已经看过可用的导入选项&尝试了一些&结果看起来不像我最终使用egit> git导入项目的项目。当我使用'从git导入项目'时,所有数百个src文件夹,罐子&其他资源出现在正确的地方。

我觉得这可能是一个愚蠢的问题,我学习的东西需要知道的基础。在我的日食知识中有许多漏洞。



任何帮助,洞察力或方向都将不胜感激。

解决方案


所以试试看,我将工作的
目录复制到一个新的位置创建了一个
的git回购& init然后将所有
文件添加到工作目录中。


您不应该复制任何内容。如果你已经有了一个git仓库,你可以将它克隆到Eclipse的工作区中。如果你有一个Eclipse项目中的代码,你可以在项目目录中执行 git init


我的想法是我可以从命令行控制所有
git函数,
然后在eclipse中使用F5 -refresh,所以
任何git操作都是
反映在项目中。


是的,这是一个有效的工作流程。我已经在Eclipse的工作区中获得了我的存储库。在完成git操作后,我只需使用F5刷新Eclipse中的文件。如果您将来希望使用egit,那么您可以简单地将它指向当时的存储库。


我已经
查看可用的导入选项&
尝试了一些&结果看起来不像
这样的项目,就像使用egit>从
git导入项目结束
一样。当我使用'从
git'导入项目时,所有的数百个src文件夹,
jars&其他资源显示在
中是正确的位置。


至于导入,我假设您已经有一个.project文件您的存储库,因为从egit导入时会自动处理jar和资源。您应该使用现有的.project文件导入。转到文件 - >导入 - >'现有项目进入工作区'。将它指向您签出的回购协议,它会正常工作。


I asked a question a relating to Egit a few weeks ago & it was suggested that I read pro git, which I have been referencing. I'd rather use git from the command line and wait for egit's stable release with the Eclipse Indigo release in June, because there are to many bugs and it tends to make my ide stall.

So to try it out I copied my working directory to a new location created a git repo & init then added all the files in the working directory. My thought was I could control all the git functions from the command line, then use F5 -refresh in eclipse so that any git operations would be reflected in the project.

Firstly I'm not sure if this is a good way to go about it...there's still alot about git, eclipse & egit I don't fully understand.

But my major stumbling block at the moment is I'm not sure how to get the files from the working directory I copied into a project in eclipse, I've looked at available import options & tried a few & the results don't look anything like the project I ended up with using egit > Import projects from git. When I used 'Import projects from git' all the hundreds of src folders, jars & other resources showed up in the correct place.

I relize this may be a dumb question, I learn things on a need to know basis. There are many holes in my knowledge of eclipse.

Any help, insight or direction would be much appreciated.

解决方案

So to try it out I copied my working directory to a new location created a git repo & init then added all the files in the working directory.

You shouldn't have to copy anything. If you've already got a git repo you can just clone it into Eclipse's workspace. If you've got the code in an Eclipse project you can just do a git init in the project directory.

My thought was I could control all the git functions from the command line, then use F5 -refresh in eclipse so that any git operations would be reflected in the project.

Yes, that is a valid workflow. I've got my repository in Eclipse's workspace. After a git operation I simply use F5 to refresh the files in Eclipse. If, in the future, you do want to use egit you can simply point it at the existing repository at that time.

I've looked at available import options & tried a few & the results don't look anything like the project I ended up with using egit > Import projects from git. When I used 'Import projects from git' all the hundreds of src folders, jars & other resources showed up in the correct place.

As for importing, I assume you already have a .project file in your repository because jars and resources are handled automatically when importing from egit. You should import, using the existing .project file. Go to File -> Import -> 'Existing Projects into Workspace'. Point it towards your checked out repo and it will work fine.

这篇关于将git项目导入工作区而不使用egit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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