Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Can't separate Git workspace and repository from Eclipse project metadata
Can't separate Git workspace and repository from Eclipse project metadata [message #1300699] Thu, 17 April 2014 19:19 Go to next message
s cl is currently offline s clFriend
Messages: 4
Registered: March 2014
Junior Member
Hi,

I'm trying to obey EGit's advice to separate the projects metadata (here:.project, .cproject, .autotools) from the project's sources and .git folder. But whatever I try it fails.

Cloning the project first from its external origin to local, adding it to the Git perspective and then importing it with the Import wizard always keeps these files together in one folder.
On the other hand when I create the project as empty project first and share it then to connect it to my local Git repo the EGit wizard tries to move the workspace folder into the Git folder. The wizard itself offers me to put the repo into the working directory... Finally I can't connect to the Git repo in a separate folder.

Obviously EGit doesn't let me obey its own advice easily. For various reasons keeping Eclipse files and source files together isn't an option for me.

How can I solve this? Is this a bug?

Thank you in advance.



Re: Can't separate Git workspace and repository from Eclipse project metadata [message #1304197 is a reply to message #1300699] Sat, 19 April 2014 18:51 Go to previous messageGo to next message
R Shapiro is currently offline R ShapiroFriend
Messages: 386
Registered: June 2011
Senior Member
Where did you see a suggestion like this? Not including .project files in your Git repository , for instance, makes no sense to me. This is something that almost has to be shared among all developers.

The only related suggestion I know of is to separate project content and workspace metadata,in other words the files in in the .metadata directory associated with an Eclipse workspace.

Workspace metadata and project metadata are two completely different things. In particular project metadata including .project files, should almost be considered as part of the project's content and therefore under version control. Workspace metadata is never under version control, at least not I've ever seen. This information is designed to be user-specific and not shared.



Re: Can't separate Git workspace and repository from Eclipse project metadata [message #1305502 is a reply to message #1304197] Sun, 20 April 2014 12:44 Go to previous messageGo to next message
s cl is currently offline s clFriend
Messages: 4
Registered: March 2014
Junior Member
> Where did you see a suggestion like this?
I found it in the EGit User guide.

> Not including .project files in your Git repository , for instance, makes no sense to me. This is something that almost has to be shared among all developers.
In this case it makes sense. I'm contributing to an open source project where we don't force developers to use a particular editor. Some of us like plain text tools like vi, others Emacs or Netbeans and others - like me - Eclipse.

Re: Can't separate Git workspace and repository from Eclipse project metadata [message #1305611 is a reply to message #1305502] Sun, 20 April 2014 14:15 Go to previous messageGo to next message
R Shapiro is currently offline R ShapiroFriend
Messages: 386
Registered: June 2011
Senior Member
I just looked at the User Guide, and I can't find any recommendation not to keep project metadata under version control. Quite the contrary. The examples specifically show .project files in the repo.

What I do see is a recommendation not to keep repositories in the workspace directory. That's an excellent recommendation regardless of what version control system you're using.

It is true that the default location for new projects is the workspace directory, which is a terrible idea: that's the one place you don't want to use for project content.

I don't know why EGit uses this default but it is just a default. You don't have to use it and in general you probably shouldn't

re: excluding .project files: What possible harm does a small (and by default invisible) file do to developers who aren't using Eclipse? The presence of a .project doesn't force anyone to do anything. On the other hand if even one other developer is using Eclipse it's a win to have it under version control. For that matter it's a win even for a single developer if he or she is working on more than one machine.

In short this is a one-way bet: core project metadata (again, not to be confused with workspace metadata) should almost always be under version control. The only exception I've ever encountered is an unrelated plugin from SonarQube, which keeps a timestamp in a project metadata file, thereby modifying the file on every use. Ugh.
Re: Can't separate Git workspace and repository from Eclipse project metadata [message #1744934 is a reply to message #1300699] Mon, 03 October 2016 06:56 Go to previous messageGo to next message
Osmund Francis is currently offline Osmund FrancisFriend
Messages: 1
Registered: October 2016
Junior Member
The EGit User Guide recommends "Don't create the Repository within the Eclipse workspace." It does not say how to achieve this if you want your working tree in your workspace.

I could achieve this using Git by issues a clone command with the --separate-git-dir parameter.

In other words, I would have:
repository: \repository\my-project\
working tree: \workspace\my-project\
Re: Can't separate Git workspace and repository from Eclipse project metadata [message #1746417 is a reply to message #1744934] Fri, 28 October 2016 12:34 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
- Create a new project in Eclipse. By default Eclipse will place it in the workspace.
- Select the project and click "Team > Share Project with Git"
- Click "Create..." and enter the path where you want to place your repository
- click "Finish" this will create the new repository in the path you selected
- choose the target path relative to the newly created repository your project should be moved to,
if you leave this empty the project will be placed into the root directory of the new repository
- click "Finish" this will move your project into the repository you just created at the path within the repository you specified
Previous Topic:folder ignored in submodule appears as tracked
Next Topic:remove a folder from git control
Goto Forum:
  


Current Time: Thu Apr 25 15:54:32 GMT 2024

Powered by FUDForum. Page generated in 0.04342 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top