Maintaining git repo inside another git repository

Here is what I would like:

REPO-A /.git /otherFiles /REPO-B /.git /moreFiles 

I want all the contents of REPO-A to be deleted on REMOTE-A and only REPO-B on REMOTE-B.

Possible?

+56
git version-control github
Jan 11 '11 at 15:53
source share
3 answers

Looks like you want to use Git submodules .

Git solves this problem using submodules. Submodules allow you to store a Git repository as a subdirectory of another Git repository. This allows you to clone another repository into your project and save your commits separately.

+43
Jan 11 '11 at 16:05
source share

I have always used symbolic links to support two separate and different repositories.

+41
Jan 11 '11 at 16:38
source share

Yes, you can do exactly what you ask with the file hierarchy you drew. Repo-B will be independent and will not know about Repo-A. Repo-A will track all changes in its own files and Repo-B files.

However, I would not recommend doing this. Every time you change files and commit them to Repo-B, you will have to make transactions in Repo-A. Branching in Repo-B will be messy with Repo-A, and branching in Repo-A will be unstable (problems with deleting folders, etc.). Submodules are definitely the way to go.

+14
Jan 11 2018-11-11T00:
source share



All Articles