If you need to manage multiple projects within a single repository, you can use a subtree merge to handle all the references.
Typically, a subtree merge is used to contain a repository within a repository. The "subrepository" is stored in a folder of the main repository.
Merge another repository into it as a subtree called Spoon-Knife.
The test project will use that subproject as if it were part of the same repository.
Fetch updates from Spoon-Knife into our test project.
Create a new directory and navigate to it.
Initialize a new Git repository.
Create and commit a new file.
Add a new remote URL pointing to the separate project that we're interested in.
remote: Counting objects: 1732, done.
Receiving objects: 100% (1732/1732), 528.19 KiB | 621 KiB/s, done.
Resolving deltas: 100% (1086/1086), done.
Merge the Spoon-Knife project into the local Git project. This doesn't change any of your files locally, but it does prepare Git for the next step.
Create a new directory called spoon-knife, and copy the Git history of the Spoon-Knife project into it.
Commit the changes to keep them safe.
git commit -m "Subtree merged in spoon-knife"
Although we've only added one subproject, any number of subprojects can be incorporated into a Git repository.
Tip: If you create a fresh clone of the repository in the future, the remotes you've added will not be created for you. You will have to add them again using the git remote add command.
"How to use the subtree merge strategy"