0

I have a remote Git repository with approx. the following repository structure:

service1/
service1/image1/
service1/image1/docker/
service1/image1/docker/Dockerfile
service2/
service2/image2/
service2/iamge2/docker/
service2/image2/docker/Dockerfile

I can clone it from https://<my-git-server>/my-project.git to obtain a directory my-project/ and a corresponding file structure underneath it.

My service2 is a Tomcat server that hosts a webapp whose source code I would like to push into the same remote repository next.

Eclipse's file structure inside the project folder is approx. as follows (as is normal for Dynamic Web Projects in Eclipse):

my-project/WebContent/
my-project/build/
my-project/src/

If possible, I would like to arrive at a new repository structure for the remote Git repository as follows:

service1/
service1/image1/docker/
service1/image1/docker/Dockerfile
service2/
service2/image2/
service2/image2/docker/
service2/image2/docker/Dockerfile
service2/image2/eclipse/
service2/image2/eclipse/my-project/
service2/image2/eclipse/my-project/WebContent/
service2/image2/eclipse/my-project/build/
service2/image2/eclipse/my-project/src/

My question is: how I can specify the additional path component eclipse/myproject? I understand that pushing from Eclipse to https://<my-git-server>/my-project.git would result in WebContent, build and src becoming siblings of service1 and service2, and that pushing from Eclipse to https://<my-git-server>/my-project.git/service2/image2/eclipse/my-project would not work either.

So how does one accomplish such a thing?

Drux
  • 11,992
  • 13
  • 66
  • 116
  • Perhaps Git [subtrees](http://stackoverflow.com/a/10648623/1789384), [submodules](https://git-scm.com/book/en/v2/Git-Tools-Submodules) or [sparse checkouts](http://stackoverflow.com/a/2303645/1789384) are the way to go? – Drux Aug 07 '16 at 01:13

1 Answers1

0

Upon further study and reflection I have decided on managing source code for my project in two Git repositories. I have no outside dependencies that would prevent me from doing so and have come to understand that monorepos and Git don't fit so well.

For reference, here are the new repository structures:

service1/
service1/image1/docker/
service1/image1/docker/Dockerfile
service2/
service2/image2/
service2/image2/docker/
service2/image2/docker/Dockerfile

WebContent/
build/
src/

If I am not mistaken, Git subtrees or submodules could now serve for cloning from these repositories into a single "mono" (as in monorepo) local view, if ever required.

Community
  • 1
  • 1
Drux
  • 11,992
  • 13
  • 66
  • 116