如何配置Araxis Merge与Git一起使用?

19

我知道Araxis Merge现在是Git的“完全支持”的mergetool,因此我能找到的大部分关于配置Git使用它的内容现在已经过时。特别地,Araxis Merge应该可以“开箱即用”,只需要执行以下操作:

git config --global merge.tool araxis

假设 araxis 已经在我的 PATH 路径中。

但是,由于若干原因,修改 PATH 不是一个选项,所以我需要能够在 .gitconfig 文件中指定正确的 pathcmd

我该如何配置 Git(在 OS X 上),以便找到 Araxis Merge?仅按照其他工具(例如 kdiff3p4merge)的示例设置即可。

git config --global mergetool.araxis.path /Applications/Araxis Merge.app/Contents/MacOS/Araxis Merge

不起作用;猜测也不行

git config --global mergetool.araxis.path /Applications/Araxis Merge.app/Contents/Utilities/araxisgitmerge
git config --global difftool.araxis.path /Applications/Araxis Merge.app/Contents/Utilities/araxisgitdiff

我应该如何配置我的araxis.path?还需要在使用Araxis Merge时使用其他的Git设置吗?

5个回答

21

现在Git直接使用Araxis的compare工具,而不是araxisgitdiffaraxisgitmerge,所以只需要设置path即可。

/Applications/Araxis Merge.app/Contents/Utilities/compare

例如,通过执行

git config --global mergetool.araxis.path '/Applications/Araxis Merge.app/Contents/Utilities/compare'

或者直接编辑~/.gitconfig,将其包含在内。

[mergetool "araxis"]
     path = /Applications/Araxis Merge.app/Contents/Utilities/compare

你也可以通过在结尾添加/max参数来强制全屏打开,像这样:C:\Program Files (x86)\Araxis\Araxis Merge\Compare.exe /max。适用于Windows。 - Mladen Janjetovic
@MladenJanjetović:不起作用。将“-max”添加到“path”会失败。 - orome
@raxacoricofallapatorius,你试过使用/max吗?不是-max。我也在tortoiseSvn中使用这个。 - Mladen Janjetovic
@MladenJanjetović:两者都可以。我在使用OS X,所以-max可以从命令行中工作。 - orome
@ raxacoricofallapatorius - 在Windows上运行良好。我看到iOS文档中有一个参数可用于araxis控制台,但没有苹果设备可以尝试:http://www.araxis.com/merge/documentation-os-x/command-line.en - Mladen Janjetovic
@MladenJanjetović:我不确定为什么它在这里不起作用。-max选项在命令行中确实有效。也许你的意思是cmd = ...,并使用适当的附加参数(无论是什么)来捕获提交? - orome

6

这里的线程很难理解,因此我在下面粘贴了对我有效的确切.gitconfig:

[diff]
tool = araxis

[merge]
tool = araxis

[mergetool "araxis"]
        path = /Applications/Araxis Merge.app/Contents/Utilities/compare

1
  1. path = 后面需要使用 ""。 path = "/Applications/Araxis Merge.app/Contents/Utilities/compare"
  2. 我将所有代码添加到了 ~/.gitconfig 中,但本地文件 gitconfig 不起作用,我不知道为什么...
- volos

5

请确保您正在运行1.6.4或更高版本的git。从Araxis Merge安装映像中的Utilities文件夹复制这些实用程序到/usr/local/bin

araxisgitmerge
araxisopendiff
compare
compare2

然后编辑~/.gitconfig文件并添加以下行:

[diff]
    tool = araxis
[merge]
    tool = araxis

下次您键入git mergetool时,它应该启动Araxis Merge图形工具。
此信息来自官方Araxis文档,可在这里找到。

1

如果您使用SourceTree(我正在使用v3.0.8),那么配置Araxis Merge作为外部差异工具非常容易:

要使用Araxis Merge查看文件差异:

  • 安装Araxis Merge
  • 在SourceTree中:工具 > 选项 > 差异 > 外部差异工具 > 从下拉菜单中选择AraxisMerge > 确定

(无需定义参数,无需重新启动SourceTree)

使用示例:

  • 右键单击要比较的未提交文件 > 选择“外部差异”(或选择文件然后CTRL-D)-这将比较您最新更改和本地存储库之间的差异。

1

@raxacoricofallapatorius 很棒的回答!但是你需要用引号运行该命令行(由于Araxis Merge中的空格)。没有引号会产生截断的路径“/Applications/Araxis”,显然无法正常工作,但添加引号并重新运行该命令可以解决我的问题。谢谢!

修复:

git config --global mergetool.araxis.path "/Applications/Araxis Merge.app/Contents/Utilities/compare"

谢谢。这应该是对上面答案的评论,现在已经修复,或者是建议修改,而不是新答案。 - orome

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接