1

I am working with Git/SourceTree/Eclipse. I am cloning a GIT repo outside of my Eclipse workspace. SourceTree is now pointing to this location.

There is no .project file in GIT. So in Eclipse I create a new dynamic web project and import my GIT repo (including the .git folder) into it. 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. So I'd have to make another repo in SourceTree just to point to my Eclipse workspace.

I cloned the GIT repo outside my workspace because I heard that's best practice. But surely there's got to be a simpler way.

What is that simpler way?

Thanks for any helpful tips.

fumeng
  • 1,771
  • 5
  • 22
  • 61

1 Answers1

1

Since you imported the folder with the .git-folder into your workspace-folder, you could just use that directory for your development now. 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?).

Probably cloning with EGit could make your life easier because it can point to a .git-folder outside your workspace-folder. (http://wiki.eclipse.org/EGit/User_Guide#Cloning_Remote_Repositories)

Community
  • 1
  • 1
hansvb
  • 190
  • 2
  • 9
  • If I clone with EGit can I still manage my repo with SourceTree? Or would I be forced to do it in EGit? – fumeng Oct 01 '14 at 19:27
  • Good point. I think SourceTree expects `.git` to be in the current directory so I would say NO but have to check on this. Note that you can also put Eclipse projects as subdirectories of a git repository which might solve the problem of having Eclipse slow down as it wouldn't try to access `.git` anymore. Technically the .git-repository is then still in your `workspace`-directory but it is out of your Eclipse project folder (which might also be referred to as "workspace"). – hansvb Oct 01 '14 at 22:27