Search code examples
gitgithubpullgit-pullmultiple-repositories

GitHub maintain repo within repo directory


Im super new with using GitHub.. I cloned in a repo at html/mycms (repo is mycms) and now I have another repo I would like to maintain within.. I cloned it in at html/mycms/system/docs (repo is called docs).

BUT, not when I pull, I only get updates to html/mycms and the docs one is ignored? I assume this is because the folder html/mycms has already been set to the mycms repo? I don't know how to fix this issue though..

How can I pull the docs repo while it's within my mycms repo? And can I pull both at the same time somehow?

Thanks!


Solution

  • You have to use git submodules for what you want. The docs repo will have to be hosted separately (on Github) and you add it as a submodule to your main repo. That way, when you clone it as git clone --recursive [email protected]:user/mainrepo, you will get the submodule docs repo in as well.

    Look here to know about submodules: http://progit.org/book/ch6-6.html