简体   繁体   English

Git 将原始仓库合并到 Fork

[英]Git Merge Original Repo into Fork

I want to manage a few apps for different customers.我想为不同的客户管理一些应用程序。 I want to fork them from a mother project that has all key features every customer needs.我想从一个母项目中分叉它们,该项目具有每个客户需要的所有关键功能。 I will use the forks to customize the different apps, brand them and sometimes add specific features.我将使用分叉来定制不同的应用程序,给它们打上品牌,有时还会添加特定的功能。 Now I would like to add some new key features, eg Apple Watch support or anything else that is asked for every fork.现在我想添加一些新的关键功能,例如 Apple Watch 支持或每个前叉要求的任何其他功能。

So my question is: Is there a way to do add the new features to the mother app and push the changes to the forks?所以我的问题是:有没有办法将新功能添加到母应用程序并将更改推送到分叉? Or do I have to work with branches and push the mother branch into the heirs?还是我必须与分支一起工作并将母分支推入继承人?

Thank you for your help!感谢您的帮助! :) :)

You can do it as library as suggested in another answer.您可以按照另一个答案中的建议将其作为库来执行。 Real git way is this:真正的 git 方式是这样的:

  • At first setup your master to track to remote original repo master.首先设置您的主人以跟踪远程原始回购主人。
  • Than pull original master.比拉原高手。
  • Checkout your custom branch签出您的自定义分支
  • make rebase with branch master使用分支 master 进行 rebase
  • now your custom branch contain new possibility from mother project and you can push custom branch to its custom repo现在您的自定义分支包含来自母项目的新可能性,您可以将自定义分支推送到其自定义存储库

You can do this by creating a library with all of the common features between all variations of the app.您可以通过创建一个包含应用程序所有变体之间所有通用功能的库来实现此目的。 The library can be in its own repo with separate repos for each variation.库可以在它自己的仓库中,每个变体都有单独的仓库。 This is by far the best solution, in my opinion, since you can make changes to the library independently from the individual apps.在我看来,这是迄今为止最好的解决方案,因为您可以独立于各个应用程序对库进行更改。

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

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