混帐合并不同的存储库? [英] git merge different repositories?
问题描述
有时项目B是作为项目A的副本产生的。
当项目A有一个通用更改时,我可以在目录B中使用
svn merge A
它会合并这些更改。 现在,如果我想使用git。我不喜欢将我的所有项目放在同一个存储库中,因为我必须克隆所有内容,并且不能像SVN中那样选择一个项目。
但是每个项目都有一个存储库,我该怎么做,就像我之前用SVN做过的一样?
问题是:
如果我想要几个子项目真正涉及到一个原始项目并保持同步,那么构建它的最佳方式是什么?如果你有两个项目, 和
proj2
和要 proj1
的更改合并到 proj2
,你可以这样做:
#在proj2中:#b $ b git remote添加proj1路径/到/ proj1
混帐取proj1
git的合并要合并
proj1 /主站#或其他任何分支
我相信这和你在SVN中所做的一样。
I've been using SVN for all my projects.
Sometimes project B is originating as a copy from project A.
When project A has a generic change, I can use svn merge A
within directory B and it will merge those changes.
Now, if I wanted to use git. I don't like having all my projects in the same repository since I then have to clone everything and can't pick just one project like in SVN. But having one repository for each project, how do I go about doing the same like I did earlier with SVN?
The question is: What's the best way to structure it if I want several subprojects that really all relates to one original project and to keep them in sync? And that I also want to be able to check them out separately
If you have two projects, proj1
and proj2
and want to merge changes of proj1
into proj2
, you would do it like this:
# in proj2:
git remote add proj1 path/to/proj1
git fetch proj1
git merge proj1/master # or whichever branch you want to merge
I believe this does the same thing as what you were doing with SVN.
这篇关于混帐合并不同的存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!