将更改同步到分叉的分叉

Syncing changes to a fork of a fork

我正在 bitbucket 上开发一个应用程序,该应用程序后来被分叉以容纳特殊模块。这个新的叉子包含高级功能。现在这个分叉后来又为某个国家分叉了。这是我的图表。

-- Core Application
    -- Premium Features
        -- Premium Features for a certain country

这就是我想要的: 可以说我正在研究 "premium features"。提交后,我对 "core application" 进行了新的更改。我希望这个新变化一直反映到 "premium Features for a certain country"。

同样,如果对 "premium features" 进行了新的更改,那么它应该只添加到 "Premium Features for a certain country" 而不是 "core application"

这是我尝试过的方法:当使用高级功能时

git remote add upstream https://github.com/user/core-application.git
git fetch upstream
git checkout master
git rebase upstream/master

我的理解是,这会将所有代码从核心应用程序中提取到高级功能中,然后 rebase 会重做对 "premium features" 的新更改。

您的 "Premium Features for a certain country" 存储库中可以有多个遥控器并从其他遥控器拉取:

git remote add core-upstream https://github.com/user/core-application.git
git remote add premium-features-upstream https://github.com/user/core-application.git

git pull core-upstream master
git pull premium-features-upstream master

感谢@vampire,我终于弄明白了。所以这是我现在的新工作流程。

如果核心有变化,我会获取并合并变化,一直到 "Premium Features for a certain country"。如果我对 "premium feature" 分支进行更改,那么我只需获取并将其合并到 "Premium Features for a certain country" 中。

我不确定如果我不立即合并核心更改并继续提交 "premium changes" 会发生什么,但理论上如果文件中没有冲突,即使在一些提交之后它也应该可以很好地合并。