109

我已经设置:

git config --global merge.tool meld
git config --global mergetool.meld.path c:/Progra~2/meld/bin/

在“git mergetool”上它写道:

Hit return to start merge resolution tool (meld):
The merge tool meld is not available as 'c:/Progra~2/meld/bin/'

我也试过:

  • /c/程序~2/meld/bin/
  • "/c/程序文件 (x86)/meld/bin/"
  • "c:/程序文件 (x86)/meld/bin/"

结果是一样的。

当我去 C:/Program files (x86)/meld/bin/ 并运行

python meld

工具运行。

4

10 回答 10

82

You could use complete unix paths like:

PATH=$PATH:/c/python26
git config --global merge.tool meld
git config --global mergetool.meld.path /c/Program files (x86)/meld/bin/meld

This is what is described in "How to get meld working with git on Windows"

Or you can adopt the wrapper approach described in "Use Meld with Git on Windows"

# set up Meld as the default gui diff tool
$ git config --global  diff.guitool meld

# set the path to Meld
$ git config --global mergetool.meld.path C:/meld-1.6.0/Bin/meld.sh

With a script meld.sh:

#!/bin/env bash
C:/Python27/pythonw.exe C:/meld-1.6.0/bin/meld $@

abergmeier mentions in the comments:

I had to do:

git config --global merge.tool meld
git config --global mergetool.meld.path /c/Program files (x86)/Meld/meld/meldc.exe

Note that meldc.exe was especially created to be invoked on Windows via console. Thus meld.exe will not work properly.


CenterOrbit mentions in the comments for Mac OS to install homebrew, and then:

brew cask install meld
git config --global merge.tool meld
git config --global  diff.guitool meld
于 2012-10-18T14:57:45.687 回答
27

这在 Windows 8.1 和 Windows 10 上对我有用。

git config --global mergetool.meld.path "/c/Program Files (x86)/meld/meld.exe"
于 2015-07-15T07:40:50.480 回答
15

融合 3.14.0

[merge]
    tool = meld
[mergetool "meld"]
    path = C:/Program Files (x86)/Meld/Meld.exe
    cmd = \"C:/Program Files (x86)/Meld/Meld.exe\" --diff \"$BASE\" \"$LOCAL\" \"$REMOTE\" --output \"$MERGED\"
于 2015-11-27T10:20:05.410 回答
6

我认为这mergetool.meld.path应该直接指向 meld 可执行文件。因此,您想要的命令是:

git config --global mergetool.meld.path c:/Progra~2/meld/bin/meld
于 2013-02-01T19:08:16.280 回答
5

这里没有其他答案对我有用,可能来自尝试所有这些答案的组合。我能够调整这个公认的答案来与 meld 一起工作。这现在适用于 git 1.9.4、meld 3.14.0 和 windows 8.1。

编辑 ~/.gitconfig 看起来像:

[diff]
    tool = meld
    guitool = meld
[mergetool "meld"]
    path = c:/Program Files (x86)/Meld/Meld.exe
[difftool "meld"]
    path = c:/Program Files (x86)/Meld/Meld.exe
于 2015-10-24T05:15:18.937 回答
4

安装它http://meldmerge.org/后, 我不得不告诉 git 它在哪里:

git config --global merge.tool meld
git config --global diff.tool meld
git config --global mergetool.meld.path “C:\Program Files (x86)\Meld\meld.exe”

这似乎奏效了。使用“git difftool”或“git mergetool”进行合并和比较</p>

如果有人在启动后遇到诸如 Meld 崩溃之类的问题(python 的问题指示),那么您需要将 Meld/lib 设置为您的系统环境变量,如下所示 C:\Program Files (x86)\Meld\lib

于 2019-11-05T11:13:47.177 回答
1

为了让 meld 在 Windows 上为我工作,需要进行一些排列。这是我当前的 .gitconfig:

[merge]
    conflictstyle = diff3
    tool = meld
[mergetool "meld"]
    cmd = \"C:\\Program Files (x86)\\Meld\\Meld.exe\" --auto-merge \"$LOCAL\" \"$BASE\" \"$REMOTE\" --output \"$MERGED\"

Linux:

[merge]
    conflictstyle = diff3
    tool = meld
[mergetool "meld"]
    cmd = meld --auto-merge $LOCAL $BASE $REMOTE --output=$MERGED --diff $BASE $LOCAL --diff $BASE $REMOTE

我相信添加conflictstyle = diff3会更改内联文本以在输出文件中包含 BASE 内容,然后再融合到它,这可能会给它一个良好的开端。没有把握。

现在,由于我已经注意到 Meld 支持三向合并,因此还有另一种选择。当设置“diff3” git 冲突样式时,Meld 在显示 BASE 内容的行上打印“(??)”。资源

一些我非常喜欢的融合命令行功能:

  • --auto-merge在为您选择正确的东西方面做得很好(它不是防弹的,但我认为节省的时间值得任何风险)。

  • 您可以在同一命令中添加额外的差异窗口。例如:

    --diff $BASE $LOCAL --diff $BASE $REMOTE

    将添加两个带有本地和传入补丁差异的选项卡。这些对于从 3 向视图中单独查看以查看每个分支中与基础的单独差异非常有用。不过,我无法在 Windows 上使用它。

  • 某些版本的 meld 允许您使用--label. 在 git 将传递给 meld 的文件的名称修复为包括本地/基本/远程之前,这一点更为重要。

  • 的顺序--diff会影响标签顺序。我在一些将附加差异放在首位的旧版本中遇到了麻烦,而主要的 3 路差异则更频繁地使用。

于 2020-11-10T19:10:44.133 回答
0

git config --global merge.tool 融合 git config --global mergetool.meld.path c:/Progra~2/meld/Meld/

于 2022-02-21T05:00:43.270 回答
0

对于windows,添加meld的路径如下:

 git config --global mergetool.meld.path C:\\Meld_run\\Meld.exe
于 2017-06-07T09:31:31.143 回答
0

在 C:\Users\username 的 .gitconfig 文件中添加以下行,解决了我在 Windows 10 中的 3.20.3 问题。

[user]
    name = doe
    email = doe@john.com
[core]
longpaths = true
[diff]
    tool = meld
[difftool "meld"]
    path=C:/Program Files/Meld/Meld.exe
[difftool]
    prompt = false
[merge]
    tool = meld
[mergetool "meld"]
    path=C:/Program Files/Meld/Meld.exe
[mergetool]
    prompt = false
    KeepBackup = false 
于 2021-04-29T09:44:29.757 回答