0

I am using a github repository that I have modified to my purposes. This repo is now part of a bigger project, that I want to publish. The github repository and all its files shall be committed. It would also be desirable if others who pull the project see the history of the github project to modify or rebase it when necessary. Basically others should be able to get exactly what I am working on locally.

My research told me that git subtree is what I would be looking for. Yet all advice I could find was about how to include a project as subtree. I instead already have all the folders and files locally and I am now looking for a way to declare the subdirectory a subtree afterwards. For clarification, here is my folder structure:

/MyProject //its history shall contain all the files from every folder below
    /Stuff
    /MoreStuff
    /GitHubProject //with the official history and my changes

Is there a way to do this? I am in no way limited to the use of git subtree if there is another, better option I do not know yet.

Edit: I first finished my adaptations on the GitHub project and then wanted to push it together with the rest of the project in the remote repository of MyProject. It uploaded the following:

/MyProject
    /Stuff
    /MoreStuff

The GitHub repository is missing and this is what I would like to change. It should appear online so that everyone who pulls the repo gets everything she needs.

RSynch
  • 1
  • 2
  • Possible duplicate of [Detach (move) subdirectory into separate Git repository](https://stackoverflow.com/questions/359424/detach-move-subdirectory-into-separate-git-repository) – phd Feb 26 '18 at 11:09
  • My intention is not to change the folder structure or split the two repos up. I want to keep the structure as described initially, but git does not include the GitHub repo in the remote repository of the entire project. – RSynch Feb 26 '18 at 12:03
  • 1
    You literally cannot do what you want: a repository *never* contains another repository. A repository can *refer to* another repository, but each repository is otherwise independent. The reference from one repository to another is called a submodule, and submodules have some things about them that make them unpleasant to work with, but that might be what you want. – torek Feb 26 '18 at 15:31
  • 1
    The other alternative is to incorporate the *contents* of the other repository into your own repository, perhaps including its history. In this case you just get one bigger repository: it *does not have* a sub-repository. Repositories are inherently self-contained, which is why a repository cannot contain another repository. – torek Feb 26 '18 at 15:33

0 Answers0