[英]Undestanding Meld 3 way merge change flow directions
I am trying to complete a 3 way merge for a cherry picked commit, using Meld.我正在尝试使用 Meld 为樱桃挑选的提交完成 3 路合并。 However, I have difficulties understanding the directions in which changes flow between the 3 files shown by Meld.
但是,我很难理解 Meld 显示的 3 个文件之间变化的方向。 To give a better illustration, let's consider the following case:
为了更好地说明,让我们考虑以下情况:
On the master branch at commit 4e623e0, we have a tracked file, called test.c and it looks like this:在提交 4e623e0 的主分支上,我们有一个跟踪文件,称为 test.c,它看起来像这样:
#include <stdio.h>
int main()
{
printf("Hello world!\n");
return 0;
}
We create branch 'other', and commit changes to test.c, so branch other is at commit 29771b0, and the test.c file looks like this:我们创建分支“other”,并将更改提交到 test.c,因此分支 other 位于提交 29771b0,test.c 文件如下所示:
#include <stdio.h>
#include "foo.h"
#include "headerx.h"
#include "headery.h"
#include "headerz.h"
int main()
{
printf("Hello world!\n");
if (x(2) > x(3))
return -1;
else if (z(2) > z(3))
return 44;
return 0;
}
Now we go back to branch 'master', and commit changes to test.c, so branch master is at commit 02fd8c8, and the test.c file looks like this:现在我们将 go 返回到分支“master”,并将更改提交到 test.c,因此分支 master 位于提交 02fd8c8,并且 test.Z4A8A08F09D347B7379563Z 文件看起来像这样:
include <stdio.h>
#include "foo.h"
#include "bar.h"
int main()
{
printf("Hello world!\n");
return bar_fun(2);
}
Finally, on the master branch, we attempt to do最后,在主分支上,我们尝试做
git cherry-pick 29771b0
git mergetool
and the following window shows up:并出现以下 window :
My question is:我的问题是:
A cherry-pick is an interesting situation for a conflict.挑挑拣拣是一种有趣的冲突情况。 LOCAL (left pane) is code as it is on the revision where you are (in other words: HEAD ).
LOCAL(左窗格)是代码,因为它在您所在的版本上(换句话说: HEAD )。 Now, local and REMOTE get a very special meaning.
现在,local 和 REMOTE 有了非常特殊的含义。 On a normal conflict on a merge, this interface (I assume, I don't know it) would show you the tip of the other branch on the right pane and the code as it is on (roughly) the last common ancestor at the center pane, where you get to edit the way the file will look like and stuff.
在合并的正常冲突中,此界面(我假设,我不知道)将向您显示右侧窗格中另一个分支的尖端以及(大致)位于最后一个共同祖先上的代码中心窗格,您可以在其中编辑文件的外观和内容。
On a cherry-pick what those two sections show is a little different (actually, it's the same but cherry-pick is a different kind of merge).在精选上,这两个部分显示的内容有些不同(实际上,它是相同的,但精选是一种不同的合并)。 The REMOTE pane (right pane) will show you the code as it is on the revision you are cherry-picking (that's why you have the ifs as it is on other branch).... the middle pane is code as it appears on the parent of the revision you are cherry-picking (that's why it shows the code the way it looked on the first revision).
远程窗格(右窗格)将向您显示您正在挑选的修订版上的代码(这就是为什么您在其他分支上拥有 ifs 的原因)....中间窗格是出现在上的代码您正在挑选的修订版的父级(这就是为什么它以第一个修订版的方式显示代码的原因)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.