从上游分支合并到供应商分支,其中供应商分支包含上游提交的子集
我正在与一家供应商合作,该供应商为 Linux 内核提供补丁集,以便在其平台上支持 Android。这意味着他们的补丁串基于特定的 Linux 版本,并且在他们的补丁串中包含了一些 Android 补丁(我假设是精心挑选的),这些补丁适用于相同的 Linux 版本。
因此,当导入到 git 以及我们在顶部应用的更改时,历史记录看起来像这样:
v2.6.x.y v_rel_x.y o_rel_z
l--l--l---------v--v--a--v--a--a--v--v--v--------o--o--o
其中 l
是 linux 提交,v
是供应商提交,a
是 android 提交,o
是我们的提交。
让事情变得复杂的是,基于相同 Linux 内核版本的 android git 内核源代码是完全独立的,如下所示:
v2.6.x.y v2.6.x.y+1
l--l--l---------l---l
\ \ android-2.6.x
\ a--a--a--a--a
\
\ v_rel_x.y o_rel_z
v--v--a--v--a--a--v--v--v--------o--o--o
现在,我想在 android-2.6.x 版本中包含所有 android 补丁,但是我也想要所有供应商都提供补丁来支持他们的平台。不幸的是,v2.6.x.y+1..android-2.6.x
变更集中的相当多的更改已经应用于 v_rel_x.y
分支。因此,从 android-2.6.x 到 o_rel_z 的简单合并会产生大量冲突,而这些冲突根本无法手动解决。
你知道如何可靠地执行从 android-2.6.x 到 o_rel_z 的合并吗?
是的,每个分支上确实有大量的提交,并且 v_rel_x 上的 android 补丁.y 与供应商补丁完全纠缠在一起。
I am working with a vendor who provides a patchset to the linux kernel in order to support android on top of their platform. This means that they base their string of patches on a specific linux version, and in their string of patches some of the android patches are included (cherry-picked I assume), which are applied to the same linux version.
So the history looks something like this when imported into git along with our changes which are applied on top:
v2.6.x.y v_rel_x.y o_rel_z
l--l--l---------v--v--a--v--a--a--v--v--v--------o--o--o
Where l
are linux commits, v
are vendor commits, a
are android commits, and o
are our commits.
What makes this complicated is that the android git kernel source based on the same linux kernel version is completely separate, looking like this:
v2.6.x.y v2.6.x.y+1
l--l--l---------l---l
\ \ android-2.6.x
\ a--a--a--a--a
\
\ v_rel_x.y o_rel_z
v--v--a--v--a--a--v--v--v--------o--o--o
Now, I want to include all of the android patches in the android-2.6.x release, however I also want all the vendors patches to support their platform. Unfortunately quite a few of the changes in the v2.6.x.y+1..android-2.6.x
changeset are already applied to the v_rel_x.y
branch. Thus a simple merge from android-2.6.x to o_rel_z creates a huge number of conflicts, which are simply impossible to solve by hand.
Do you have any idea on how to perform the merge from android-2.6.x to o_rel_z reliably?
And yes, there are really a huge number of commits on each branch, and the android patches on the v_rel_x.y are completely entangled with the vendor patches.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的两点意见:
a) 合并并解决冲突以使代码达到理想的状态
b) 您尝试通过使用诸如 --ours 或 --theirs 之类的合并策略进行合并来自动解决冲突,具体取决于您认为更适合您的目的。
请参阅此处 Git 合并文档
您可以使用的另一种方法尝试是在更新的上游 android-2.6.x 之上重新调整 0_rel_z 分支的基础。
最后,您的问题不是冲突本身,而是您必须立即处理的冲突数量。因此,我会考虑改进管理更新的流程,可能会更频繁地进行更新(例如,每天与每周),并在更新上游的基础上不断重新调整您的开发分支,直到您准备好完成一项功能的开发。
希望有帮助!
My two cents:
a) you merge and resolve conflicts to bring the code to the desirable state
b) you're trying to resolve conflicts automatically by merging using merging strategies like --ours or --theirs depending on what you consider more correct for your purposes.
See here Git merge documentation
Another approach you may try is to rebase your 0_rel_z branch on top of the updated upstream android-2.6.x
Finally, your problem is not the conflicts them-selves, but the amount of them that you have to deal with at once. So I would take a look at improving the process how you are managing the updates, may be to make this more often (daily vs weekly, for example) and constantly rebasing your development branches on top of the updating upstream until you're ready to finalize the development of a feature.
Hope that helps!