简体   繁体   English

创建GIT回购的工作副本

[英]Creating a working copy of a GIT repo

I am working with Git/SourceTree/Eclipse. 我正在使用Git / SourceTree / Eclipse。 I am cloning a GIT repo outside of my Eclipse workspace. 我正在Eclipse工作区之外克隆一个GIT存储库。 SourceTree is now pointing to this location. SourceTree现在指向此位置。

There is no .project file in GIT. GIT中没有.project文件。 So in Eclipse I create a new dynamic web project and import my GIT repo (including the .git folder) into it. 因此,在Eclipse中,我创建了一个新的动态Web项目,并将我的GIT存储库(包括.git文件夹)导入其中。 The project builds just fine. 该项目构建良好。

Now this means that any changes I make in Eclipse won't be reflected in SourceTree because the GIT repo is essentially in 2 places. 现在这意味着我在Eclipse中所做的任何更改都不会反映在SourceTree中,因为GIT存储库实际上位于2个地方。 So I'd have to make another repo in SourceTree just to point to my Eclipse workspace. 因此,我不得不在SourceTree中进行另一个回购,以指向我的Eclipse工作区。

I cloned the GIT repo outside my workspace because I heard that's best practice. 我将GIT存储库克隆到工作区之外,因为我听说这是最佳实践。 But surely there's got to be a simpler way. 但是,肯定有一种更简单的方法。

What is that simpler way? 那更简单的方法是什么?

Thanks for any helpful tips. 感谢您提供任何有用的提示。

Since you imported the folder with the .git -folder into your workspace -folder, you could just use that directory for your development now. 由于您将带有.git -folder的文件夹导入到workspace -folder中,因此现在可以使用该目录进行开发。 You no longer need the original clone. 您不再需要原始克隆。

However, I'm guessing cloning inside the workspace -directory is considered bad practice because it can slow down your Eclipse-project (see Is it better to keep Git repository inside or outside of Eclipse workspace? ). 但是,我猜测在workspace内进行克隆被认为是不好的做法,因为它会减慢Eclipse项目的速度(请参阅将Git存储库保留在Eclipse工作区之内或之外会更好吗? )。

Probably cloning with EGit could make your life easier because it can point to a .git -folder outside your workspace -folder. 例如:It有可能克隆可以使您的生活更容易,因为它可以指向一个.git你外-folder workspace -folder。 ( http://wiki.eclipse.org/EGit/User_Guide#Cloning_Remote_Repositories ) http://wiki.eclipse.org/EGit/User_Guide#Cloning_Remote_Repositories

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM