不使用egit将git项目导入到工作区
几周前我问了一个与 Egit 有关的问题 &有人建议我阅读 pro git,我一直在参考它。 我宁愿从命令行使用 git,并等待 6 月份的 Eclipse Indigo 版本中 egit 的稳定版本,因为有很多错误,它往往会让我的 ide 停滞不前。
因此,为了尝试一下,我将工作目录复制到一个新位置,创建了一个 git repo &然后 init 添加了工作目录中的所有文件。我的想法是我可以从命令行控制所有 git 功能,然后在 eclipse 中使用 F5 -refresh 以便任何 git 操作都会反映在项目中。
首先,我不确定这是否是一个好方法……还有很多关于 git、eclipse 和 git 的内容。我不完全理解。
但目前我的主要障碍是我不确定如何从复制到 Eclipse 项目中的工作目录中获取文件,我查看了可用的导入选项和文件。尝试了一些&结果看起来与我最终使用 egit > 完成的项目完全不同从 git 导入项目。当我使用“从 git 导入项目”时,所有数百个 src 文件夹、jar 和文件都被导入了。其他资源出现在正确的位置。
我意识到这可能是一个愚蠢的问题,我在需要知道的基础上学习东西。我对eclipse的了解有很多漏洞。
任何帮助、见解或指导将不胜感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不应该复制任何东西。如果您已经有了 git 存储库,则可以将其克隆到 Eclipse 的工作区中。如果您已经在 Eclipse 项目中获得了代码,则只需在项目目录中执行 git init 即可。
是的,这是一个有效的工作流程。我的存储库位于 Eclipse 的工作区中。 git 操作后,我只需使用 F5 刷新 Eclipse 中的文件。如果将来您确实想使用 egit,您只需将其指向当时现有的存储库即可。
至于导入,我假设您的存储库中已经有一个 .project 文件,因为从 egit 导入时会自动处理 jar 和资源。您应该使用现有的 .project 文件进行导入。转到文件 ->导入-> “现有项目进入工作区”。将其指向您签出的存储库,它将正常工作。
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.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.
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.