1

所以我想有一个这样的项目:

-- Project
   -- .git
   -- SubProject (Used by project)
      -- .git

这个想法是在 github 上Project是一个 repo 并且SubProject是另一个 repo。如果我建立一个这样的项目,这是否意味着Project- 在 github 上 - 将显示一个“参考”符号来SubProject回购?

另外 - 如果是这种情况,当人 B 拉Project下来工作时,它也会把参考项目拉到里面 - SubProject?? 或者他们将不得不撤回该项目?

现在我在 git hub 上将项目分开 - 这就是我想要的,它们是两个项目 - 如何Project使用SubProject,我觉得当我开发时,SubProject我总是在内部开发它,Project然后复制到SubProject并提交 - 他们没有历史他们的。我想SubProject在项目内部进行开发,以便subproject获得一些历史。

这将如何用于推送、拉取、合并、分支以及在一天结束时标记和压缩然后分发?- 项目将是一个标记和分发的项目 -

4

1 回答 1

0

You can use, as mentioned, submodules.

As I explain in "True nature of submodules", it is a good way to keep a fix reference to another repo (SubProject) from a "parent repo" (Project).

Both repo have their history independent and separate:

  • making a branch in one won't make a branch in the other.
  • make a tag in the parent repo won't tag the submodule repo (but it will include the SHA1 of that submodule at the time of the tag, guaranteeing that pulling the parent repo from that tag will restore the right version of the submodule).

Note that, from git 1.8.2+, you can configure your submodule to track a branch of its own.
Or you can convert an existing submodule to track a branch.
And you can remove a submodule at any time.

于 2013-09-17T07:12:44.217 回答