Funkwecker
Funkwecker

Reputation: 814

GIT: Project vs Repositoryname

I am migrating my Java-project from subversion to git. The project is called MyProject. How should I name my git-repository? I find the name MyProjectRepository ugly, but just naming it MyProject is also quite distracting, because then the project is stored in the directory /home/myName/git/MyProject/MyProject ... This looks superflous, becaus /home/myName/git/MyProject contains just the hidden git-directory and the working directory MyProject.

What is naming-scheme is common practice? Or should I rename my Java-project?

Upvotes: 1

Views: 4225

Answers (1)

musiKk
musiKk

Reputation: 15189

I'm not sure why your MyProject directory should need another directory with the same name.

You just go into your project dir (MyProject in your case) and do a git init. Directly below that are the sources.

So for a simple Maven project it might look like this:

MyProject/
  .git/
  src/main/java/<your sources here>
  pom.xml

For a more complicated Maven project:

MyProject/
  .git/
  Module1/
    pom.xml
    src/main/java/
  Module2/
    pom.xml
    src/main/java/
  pom.xml                 <-- that's your parent POM

The following is an answer to a short-lived comment that is now deleted.

Regarding the issues surrounding Eclipse: I always create Eclipse projects that I want under version control outside of Eclipse in a directory that is not my workspace. Then I import the project from Eclipse (I use the Maven import but vanilla Java projects should work just as well. Just don't copy the project in the workspace). I'm pretty sure that's the same as creating the project in Eclipse and selecting a custom location in the "New Project" wizard.

If you already have a project with lots of code, just delete the project from Eclipse and make sure that the "Delete project contents on disk" option remains unselected. Then you can move the project out of the workspace and import as described above. You'll lose project specific configuration that way though.

Upvotes: 3

Related Questions