Github和Git两个回购项目在一个项目中 [英] Github and Git two repos in one project
问题描述
- 项目
- .git
- SubProject(由项目使用)
- .git
想法是在github上 Project
是一个仓库,而 SubProject
是另一个仓库。如果我设置了这样的项目,这是否意味着 Project
- 在github上 - 会显示一个refrence符号给 SubProject
repo?
另外 - 如果是这种情况,当Person B将 Project
向下拉时它也会拉动内部的参考项目 - SubProject
??或者他们将不得不然后拉该项目?现在我有项目独立git枢纽 - 这是我想要他们,他们是两个项目 - 如何 Project
使用 SubProject
,我觉得当我开发 SubProject
我总是在 Project
中开发它,然后拷贝到 SubProject
并提交 - 他们没有历史记录。我想在项目中开发 SubProject
,以便子项目
获得一些历史记录。
这项工作将如何推动,拉动,合并,分支,并在一天结束时进行标记和压缩,然后进行分发? - 项目将被标记和分发 -
可以使用,如上所述,子模块。
作为我在子模块的真实性中解释,这是保持对另一个回购(SubProject)的修复引用的好方法,从一个父母回购(项目)。
两个回购有他们的历史独立和分开:
- 在一个分支中分支不会在另一个分支中分支。
- 使在父回购不会标记子模块回购一个标签(但将包括在子模块的标签的时间的SHA1,保证从牵拉父回购标签将恢复子模块的正确版本)。
请注意,从git 1.8.2+开始,您可以配置您的子模块以跟踪其自己的分支。
或者您可以转换现有的子模块以跟踪分支。
您可以随时删除子模块。
So I want to have a project set up like this:
-- Project
-- .git
-- SubProject (Used by project)
-- .git
The idea is that on github Project
is a repo and SubProject
is another repo. if I set up a project like this, does this mean that Project
- on github - will show a "refrence" symbol to SubProject
repo?
Also - if this is the case, when Person B pulls Project
down to work on it will it also pull the reference project inside - SubProject
?? Or will they have to then pull that project?
right now I have the projects separate on git hub - which is how I want them, they are two projects - how ever Project
uses SubProject
and I feel that when I develop SubProject
I am always developing it inside of Project
then copying over to SubProject
and committing - theirs no history their. I want to develop SubProject
inside of project so that subproject
gets some history.
How will this work for pushing, pulling, merging, branching and at the end of the day tagging and zipping up to then distribute? - Project would be the one tagged and distributed -
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.
这篇关于Github和Git两个回购项目在一个项目中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!