Importing git project into workspace without using egit

偶尔善良 提交于 2019-12-06 02:03:48

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/5243568/importing-git-project-into-workspace-without-using-egit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!