Child git repository as subset of a main repository

前端 未结 3 1577
太阳男子
太阳男子 2021-02-08 12:03

I\'m looking for a way to set up git respositories that include subsets of files from a larger repository, and inherit the history from that main repository. My primary motivat

3条回答
  •  一个人的身影
    2021-02-08 12:33

    Let me first summarize your question:

    • You have a big repository
    • You want to split it into sub-repositories
    • You want to keep the integrity of your history

    From your stats I can see that you have 14 sub-projects stored in one master repository. This is usually a very poor solution because remember that every single time someone is cloning the repository, it will also get the full history of all the sub-projects. For instance If I want to contribute to one of your sub-project, I do not want to carry all the 8096 files you have.

    If the projects are unrelated to each others, just split them into sub-repositories. With GitHub you can create organizations. Do not hesitate to create your own organization an put all your sub-projects into it. The main advantage is that each sub-project will have:

    • Its own wiki
    • Its own issue tracker
    • Its own front page

    If you have related projects which each of them need to be taken from a particular commit. I recommend you to use git submodules. For example if you look at the TortoiseGit project in the ext/ folder, you will notice links to other repositories.

    Another solution would be to use git subtree, which seem not the best solution for your problem.

    If your master repository falls into any of these categories, you should review your way of using Git:

    • A Git repository is more than 100 MB
    • A Git repository stores artifacts (.exe, .tmp, binaries, generated files, .pdf...)

    Is your repository public on GitHub?

提交回复
热议问题