本文介绍了我如何强制mergetool GUI(kdiff3)始终显示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何强制mergetool GUI始终显示并禁用任何自动解析?

有时当合并期间发生冲突时,我使用mergetool,它会在我按回车后立即返回Hit return to start merge resolution工具(kdiff3),没有显示图形用户界面,冲突似乎得到解决。



我现在配置了git配置为使用kdiff3作为mergetool,但它也发生,当我有指定的mergetool codecompare。我知道在kdiff3中有一个选项自动保存并退出合并而不产生冲突,理论上这可能会导致所描述的行为,但我始终禁用/取消选中此选项。



另外,直接在git mergetool gitconfig中有 trustExitCode 选项,我已经设置为true,但即使将它设置为false,GUI也是没有显示。



我不确定谁会自动解析。在一些预处理或kdiff3中的Mergetool?



我在Windows上运行并安装了Git扩展。



与kdiff3相关的Simillar问题,在这里也被问到: Kdiff3不会用mergetool命令打开 line选项指向kdiff3,如果所有冲突均可由kdiff3自动解析,则会导致gui不显示。在kdiff3设置中,您可以指定要忽略的命令行选项,但将 - auto 设置为无效。



作为一种解决方法,我将自己的kdiff3变体配置为合并工具:

  git config --global mergetool.kdiff3NoAuto。 cmdkdiff3 --L1 \\ $ MERGED(Base)\--L2 \\ $ MERGED(Local)\--L3 \\ $ MERGED(Remote)\ -o \\ $ MERGED \\\ $ BASE \\\ $ LOCAL \\\ $ REMOTE \

这与git默认使用的kdiff3类似,但没有 - auto flag。



现在您可以调用 git mergetool -t kdiff3NoAuto 或配置 kdiff3NoAuto 作为全球合并工具,kdiff3将在解决冲突时始终显示。



更新:你的问题的一部分,如果你真的想禁用任何自动r只需将 - qall 添加到上面的 kdiff3 命令行中即可。但是,您必须手动解决文件中的所有更改,即使是那些不会导致git冲突的更改。最好的情况是:kdiff3显示了git如何合并文件并且让用户选择的冲突开放。任何人都知道如何做到这一点?


How could I force mergetool GUI to be always shown and disable any automatic resolving?

Sometimes when there is a conflict during a merge and I use the mergetool, it simply immediatelly return after I hit enter on question "Hit return to start merge resolution tool (kdiff3)" and no GUI is shown and the conflict appears to be resolved.

I have the git configured to use kdiff3 as the mergetool now, but it happened also when I have codecompare as the mergetool specified. I know that there is an option "Auto save and quit on merge without conflicts" in kdiff3, which could theoretically cause the described behaviour, but I have this option disabled/unchecked all the time.

Also, there is trustExitCode option directly in git mergetool gitconfig, which I have set to true, but even if I set it to false, the GUI is not shown.

I am not sure who does the auto resolving anyway. Mergetool in some preprocessing or kdiff3?

I am running on Windows and have the Git-extensions installed.

Simillar question specific to kdiff3, was asked also here: Kdiff3 won't open with mergetool command

解决方案

Git has --auto hard coded as command line option to kdiff3, which causes the gui not to show up if all conflicts are auto-resolvable by kdiff3. In the kdiff3 settings you can specify command line options to ignore, but putting --auto there did not work for me.

As a workaround I configured my own variant of kdiff3 as merge tool:

git config --global mergetool.kdiff3NoAuto.cmd "kdiff3 --L1 \"\$MERGED (Base)\" --L2 \"\$MERGED (Local)\" --L3 \"\$MERGED (Remote)\" -o \"\$MERGED\" \"\$BASE\" \"\$LOCAL\" \"\$REMOTE\""

This is very similar to what git uses by default for kdiff3, but without the --auto flag.

Now you can call git mergetool -t kdiff3NoAuto or configure kdiff3NoAuto as mergetool globally and kdiff3 will always show up when resolving conflicts.

Update: regarding the second part of your question, if you really want to disable any automatic resolving, just add --qall to the kdiff3 command line above. But then you have to manually resolve all changes in the file manually, even the ones that did not result in a git conflict. Best scenario would be: kdiff3 shows how git merged the files and leaves the conflicts open for the user to choose. Anyone knows how to do that?

这篇关于我如何强制mergetool GUI(kdiff3)始终显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 19:15