简体   繁体   English

GIT 提交到克隆的仓库(带有新的远程)和原始仓库

[英]GIT commit both to cloned repo (with new remote) and to the original repo

Not sure if the subject is comprehensible - let me clarify:不确定这个主题是否可以理解 - 让我澄清一下:

  • I have a new project (call it "child") cloned from another project of mine (call it "master");我有一个从我的另一个项目(称为“主”)克隆的新项目(称为“子”); so now I have two repos, each with different remotes;所以现在我有两个仓库,每个仓库都有不同的遥控器;
  • now I'd like to commit and push from the "child" to its remote, but also I'd like to push only certain modification to the "master" remote - and vice versa.现在我想从“孩子”提交并推送到它的遥控器,但我也只想将某些修改推送到“主”遥控器 - 反之亦然。

What's the best solution to get this?得到这个的最佳解决方案是什么? (Maybe it has to do with upstream functionality?) (也许它与上游功能有关?)

I would add both remotes to the child project ( git remote add upstream <url> ).我会将两个遥控器都添加到子项目中( git remote add upstream <url> )。

When you want to add something from child to upstream, I'd branch out from upstream/master.当您想将某些内容从子级添加到上游时,我会从上游/master 分支出来。 If these changes are already in the child repo, you can cherry-pick them into the new branch.如果这些更改已经在子存储库中,您可以将它们挑选到新分支中。 Then push this branch and merge it into upstream's master.然后推送这个分支并合并到上游的master中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM