简体   繁体   English

Undestanding Meld 3 路合并改变流向

[英]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:我的问题是:

  1. What sense does the marked arrow, pointing to the "LOCAL" file make?指向“本地”文件的标记箭头有什么意义?
  2. How can i turn off this "feature" (bug?)?我怎样才能关闭这个“功能”(错误?)? It is rather annoying when merging large files, when Meld marks a big block of the "BASE" code and wants to push it into the "LOCAL" file.合并大文件时相当烦人,当 Meld 标记一大块“BASE”代码并希望将其推送到“LOCAL”文件中时。
  3. If it does make sense - why would I want to change, the "LOCAL" file?如果它确实有意义 - 我为什么要更改“本地”文件? According to this SO post: Which version of the git file will be finally used: LOCAL, BASE or REMOTE?根据这个 SO 帖子: 最终将使用 git 文件的哪个版本:LOCAL、BASE 或 REMOTE? , the "LOCAL" pane should be open in read only mode. ,“本地”窗格应以只读模式打开。 I have a rough understanding, of "LOCAL", "REMOTE", "BASE", and "MERGED" files, however the considered Meld option doesn't make sense to me.我对“LOCAL”、“REMOTE”、“BASE”和“MERGED”文件有一个粗略的了解,但是考虑的 Meld 选项对我来说没有意义。

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.

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