Git repository within Git repository [duplicate]

放肆的年华 提交于 2019-12-03 00:59:40
Adrian Petrescu

You'll want to read about Git submodules.

Use git subtree in git version 1.7.11 and above. git subtree is superior to git submodule because:

  • Management of a simple workflow is easy. Older versions of git are supported (even before v1.5.2)
  • The sub-project’s code is available right after the clone of the super project is done
  • git subtree does not require users of your repository to learn anything new, they can ignore the fact that you are using subtree to manage dependencies
  • git subtree does not add new metadata files like git submodule does (such as .gitmodule)
  • Contents of the subtree can be modified without having a separate repository copy of the dependency somewhere else

Additionally, if you need to detach a subtree of your existing repository into a new repository, git subtree split can help you with that.

You can nest two git repo's without using submodules. Suppose ChildRepo is a subdirectory of ParentRepo, and both are git repositories.

+ ParentRepo
  - ChildRepo

If you add a file to ChildRepo, ParentRepo will ignore it. When you commit it it will be added to ChildRepo. It is not possible to add files within ChildRepo to ParentRepo.

More info: Nested GIT repo gotchas!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!