且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在另一个git仓库中维护git仓库

更新时间:2023-11-30 14:29:58

听起来你想要使用Git submodules


Git使用子模块解决了这个问题。子模块允许您将Git存储库作为另一个Git存储库的子目录。这允许您将另一个存储库克隆到您的项目中,并保持您的提交单独。



Here's what I'd like:

REPO-A
  /.git
  /otherFiles
  /REPO-B
    /.git
    /moreFiles

I want to be able to push all of REPO-A's contents to REMOTE-A and only REPO-B to REMOTE-B.

Possible?

It sounds like you want to use Git submodules.

Git addresses this issue using submodules. Submodules allow you to keep a Git repository as a subdirectory of another Git repository. This lets you clone another repository into your project and keep your commits separate.