Eclipse Workspace directory and ".git" directory [message #1816959] |
Tue, 12 November 2019 22:59 |
L C Messages: 17 Registered: January 2019 |
Junior Member |
|
|
Hi,
Is it proper to have ".git" directory under Eclipse workspace directory or under respective projects directories? I ended up with two ".git" directories, each under respective project (see below):
Working directory (Eclipse workspace)
|
|-.metadata
|
|--Project1
| |-- .git
| |-- .classpath
| |-- .project
| |-- ....
|
|--Project2
| |-- .git
| |-- .classpath
| |-- .project
| |-- ....
My Git remote repository looks like this:
# ls -l /var/lib/git
total 8
drwxr-xr-x 8 luser luser 4096 Nov 9 07:26 Project1.git
drwxr-xr-x 8 luser luser 4096 Sep 12 16:20 Project2.git
My setup appears to contradict the documentation ( see https://wiki.eclipse.org/EGit/User_Guide#The_longer_story. ) but it does work.
Any ideas? Potential problems? Thanks
[Updated on: Wed, 13 November 2019 13:12] Report message to a moderator
|
|
|
|
Re: Eclipse Workspace directory and ".git" directory [message #1816995 is a reply to message #1816991] |
Wed, 13 November 2019 14:08 |
L C Messages: 17 Registered: January 2019 |
Junior Member |
|
|
The way I did it, if I remember correctly, is by cloning Project1 and Project2 from the remote repository and then importing them into Eclipse, that is:
(Work is the Eclipse workspace directory)
# cd Work
# git clone /var/lib/git/Project1.git
# git clone /var/lib/git/Project2.git
(... and then import Projet1 and Project2 into Eclipse)
Any problems with the above? Thanks
[Updated on: Wed, 13 November 2019 15:04] Report message to a moderator
|
|
|
|
|
Re: Eclipse Workspace directory and ".git" directory [message #1817016 is a reply to message #1817014] |
Thu, 14 November 2019 05:01 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
Yes, it makes sense to put unrelated things in separate clones.
I see each of your projects has a .classpath file so I assume each is a Java project. It seems to me only the most trivial Java software is ever developed as a single project. Given you've made the root folder of the clone itself a project you'll never be able to add another project to the clone as your software grows in complexity. Well, technically you can, but there's no such concept as a nested Eclipse project, so you'd end up with something that doesn't fit well with the workspace concept of a project, i.e., you'll end up with a project that has a folder that is also itself a project so you'll see the same files twice in the workspace unless from the context menu you use Properties... -> Resource -> Resource Filters... to hide subfolders of a project from the workspace's view of that project, i.e., you could use that to hide the .git folder so that you don't accidentally edit it directly and so that the workspace doesn't index it or need to synchronize the state of the entire clone representation as part of the workspace's state.
It seems to me that you'd likely be better off with the project being a subfolder in the clone; then you could more easily add, for example, a JUnit project, or refactor the project into small related parts.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05243 seconds