0

I am migrating from Eclipse/SVN to Eclipse/Git and I am unsure what the best directory layout would be. I have looked at the Vogel/a guide, the Eclipse Wiki as well as the following threads: Is it better to keep Git repository inside or outside of Eclipse workspace? Should I store git repository in Home or Eclipse Workspace?

I am used to setting up eclipse like so:

~/projectA/workspace/.metadata
~/projectA/workspace/subproj1/.project
~/projectA/workspace/subproj2/.project
~/projectA/subproj1/.svn
~/projectA/subproj1/file1
~/projectA/subproj2/.svn
~/projectA/subproj2/file2

So the project holds all project related files i need. The workspace folder holds relatively little data like the local revision info, project descriptions and specific eclipse settings. The subproj folder(s) hold all the source code but also the subversion meta info. The subprojects are more (or less..) related but they all contribute to projectA. The eclipse working directory is ~/projectA/subproj1, ~/projectA/subproj2, etc.

I am not completely sure if i could use a more or less similar layout with Git. Biggest difference would be the 'repo' dir.

~/projectA/workspace/.metadata
~/projectA/workspace/subproj1/.project
~/projectA/workspace/subproj2/.project
~/projectA/subproj1/.git
~/projectA/subproj1/file1
~/projectA/subproj2/.git
~/projectA/subproj1/file2
~/projectA/repo/subproj1
~/projectA/repo/subproj2

If i set it up like the following, do I still comply with the best practices as mentioned in the Wiki?

@eugener I would assume the following layout complies with the Egit manual?:

~/projectA/workspace/.metadata
~/projectA/workspace/subproj1/.project
~/projectA/workspace/subproj2/.project
~/projectA/subproj1/.git
~/projectA/subproj1/file1
~/projectA/subproj2/.git
~/projectA/subproj1/file2
Community
  • 1
  • 1
Michel
  • 1,395
  • 13
  • 14

1 Answers1

0

I would suggest to comply with EGit Wiki simply because the the way Git works.

The main point of Git is fast branching and merging, which is accomplished in repository's workspace, location of which is fixed in the folder where your repo is. Actual repository is located one level down in .git folder.

When project in Eclipse is "shared" with Git all the files are automatically moved from Eclipse workspace where the project was created to the location of the git repo it was shared with. So project in Eclipse is just a shortcut. Branch switching replaces the files in Git workspace which is automatically reflected in Eclipse.

Eugene Ryzhikov
  • 17,131
  • 3
  • 38
  • 60
  • I **want** to comply with the EGit Wiki, the question is if i do. What I did learn was that the repo is indeed located inside the .git. – Michel Nov 23 '12 at 07:22
  • (I know the project is moved to its new location when you do Team->Share in Eclipse. I'm fine with that and used to work with the actual files outside of the Eclipse workspace.) – Michel Nov 23 '12 at 07:31