如何将Araxis设置为MSYS git的差异/合并工具?
我正在尝试使用 Araxis Merge 作为 MSYSGit 的差异/合并工具。
我在网上找到了一些资源:
- 在 Araxis 网站 上,他们提到了“简单”的方式,但它意味着可执行文件(araxisgitdiff.exe 和 araxisgitmerge.exe)不属于我的发行版。
- 我还在 gitguru,但关于:Araxis 的实际信息充其量是稀疏的,我无法从中得到任何信息。
- 最后,有一些关于较旧的 stackoverflow post,但建议的方法对我不起作用。 该特定信息是针对 OS X 的。我尽我所能“翻译”到 Windows,但没有成功:
我创建了 /bin/git-diff-driver.sh
#!/bin/sh
"/c/Program Files/Araxis/Araxis Merge/compare.exe" -title1:"$1 (repo version)" -title2:"$1 " -max "$2" "$5"
并编辑了 gitconfig
[merge]
tool = araxismerge
[mergetool "araxismerge"]
cmd = "/c/Program Files/Araxis/Araxis Merge/compare.exe" -3 -merge -wait $LOCAL $BASE $REMOTE $MERGED
[diff]
external = "/bin/git-diff-driver.sh"
我得到的唯一结果是:
$ git diff HEAD^ HEAD
外部 diff 终止,停在 PowerEditor/src/Notepad_plus.cpp。
编辑:
我还按照答案之一的建议尝试了名为 "c:/Program Files/Araxis/Araxis Merge/compare.exe"
的 exe,得到了相同的结果。
编辑:
我发现如果您使用 TortoiseGit,可以轻松设置它,但它似乎可以自行处理 diff,并且 TortoiseGit 中的任何设置都没有给出任何指示,说明如何在从命令调用 diff 时将 Araxis 设置为合并工具线。
编辑:
所以,问题是:是否有人成功使用 Araxis Merge 与 MSYSGit 比较和合并内容,如果是这样,你是怎么做的?
I'm trying to use Araxis Merge as my diff / merge tool for MSYSGit.
I found a few resources on the net:
- On the Araxis site, they mention an "easy" way, but it implies a executables (araxisgitdiff.exe and araxisgitmerge.exe) that are not part of my distro.
- I also found some info in gitguru, but the actual information re: Araxis is sparse at best, and I could not make anything out of that.
- Finally, there was some info on an older stackoverflow post, but the suggested method doesn't work for me. That particular info was geared towards OS X. I "translated" to Windows as best as I could, but without success:
I created /bin/git-diff-driver.sh
#!/bin/sh
"/c/Program Files/Araxis/Araxis Merge/compare.exe" -title1:"$1 (repo version)" -title2:"$1 " -max "$2" "$5"
and edited gitconfig
[merge]
tool = araxismerge
[mergetool "araxismerge"]
cmd = "/c/Program Files/Araxis/Araxis Merge/compare.exe" -3 -merge -wait $LOCAL $BASE $REMOTE $MERGED
[diff]
external = "/bin/git-diff-driver.sh"
and the only result I get is:
$ git diff HEAD^ HEAD
external diff died, stopping at PowerEditor/src/Notepad_plus.cpp.
Edit:
I've also tried with the exe named as "c:/Program Files/Araxis/Araxis Merge/compare.exe"
as suggested by one of the answers, with the same results.
Edit:
I've found that it can easily be set if you use TortoiseGit, but it seems to handle diff by itself and no settings from TortoiseGit give any indication on how to set up Araxis as a merge tool when diff is invoked from the command line.
Edit:
So, the question is: Is there anybody who successfully uses Araxis Merge to diff and merge stuff with MSYSGit, and if so, how do you it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
如果你想让“git diff”始终使用 araxis,你可以使用帮助文件中的说明,但如果你想控制使用“git diff”,就像你通常从命令行和“git difftool”参与一样Araxis GUI。
尝试将以下内容添加到您的 git 配置中::
If you want to have 'git diff' always use araxis you can use the instructions in the help file, but if you want to have control to use 'git diff' as you normally would from the command line and 'git difftool' to engage the Araxis GUI.
Try adding the following to your git config::
araxis 的文档已更新: http://www .araxis.com/merge/documentation-windows/integrating-with-other-applications#Git
我可以使用那里显示的配置,无需任何修改。
The documentation at araxis has been updated: http://www.araxis.com/merge/documentation-windows/integrating-with-other-applications#Git
I can use the configuration shown there without any modifications.
是的...我让它工作了,使用 msysgit 版本 1.6.3.2.1299.gee46c,在 DOS 或 Git Bash 下,使用 Araxis Merge 2009,v2009.3713 的评估许可证:
该方法是使用新的
git difftool
和git mergetool
,而不是普通 diff 。首先,让我们为这些 diff 和 merge 工具设置一些脚本
注意:
git-difftool--helper
,即使我输入 ',我也会使用 difftool git diff
'。$MERGED
传递给 difftool 脚本:这是唯一具有所比较文件真实名称的变量。$LOCAL
和$REMOTE
是临时名称。对于合并工具,您可以设置以下全局值:
通过将这些工具设置为某些 shell 脚本,您将能够从这些脚本内切换工具。
另一种方法是命名您的工具(
mergetool.araxis.cmd
、mergetool.winmerge.cmd
...)并在diff 中指定正确的工具.tool
或merge.tool
设置。在全局环境变量
PATH
引用的目录中创建difftool.sh
和mergetool.sh
。 它们甚至可以在 DOS 下工作(它们是sh
-- shell -- 脚本)difftool.sh
注意:
不可能有 -title1:" someTitle With Space"...只有没有空格的标题才有效...,所以现在,尝试不使用任何 'titleN
' 选项。知道了! 不能将标题值直接传递给
-title
选项,需要将其设置为局部变量,并用"' '"
引号组合(双引号会消失)在 shell 脚本执行期间,保留简单的引号,并在标题中允许空格!)$3
代表真实名称,而不是用于比较目的的临时文件名。 因此,在title1
选项中使用$3
,其中包含空格。git diff HEAD^ HEAD
在 DOS 会话中不起作用:只有git diff "HEAD^" HEAD
可以。mergetool.sh
我不确定这些脚本在涉及多个文件时是否能正常工作(多个差异、要合并的多个文件)。刚刚测试过:它可以工作,并且 Araxiscompare.exe 确实为每个文件打开一个选项卡来比较或合并。
尝试一下并让我们知道;)
Right... I got it working, with msysgit version 1.6.3.2.1299.gee46c, under DOS or Git Bash, with an evaluation license for Araxis Merge 2009, v2009.3713:
The approach is to use the new
git difftool
andgit mergetool
, instead of plain diff.First, let's setup some scripts for those diff and merge tool
Notes:
git-difftool--helper
, I will use difftool even when I will type 'git diff
'.$MERGED
to your difftool script: that is the only variable with the real name of the file being diff'ed.$LOCAL
and$REMOTE
are temporary names.For the merge tool, you would set the following global values:
By setting those tools to some shell scripts, you will be able to switch tools from within those scripts.
Another approach is to name your tools (
mergetool.araxis.cmd
,mergetool.winmerge.cmd
, ...) and to specify the right tool in thediff.tool
ormerge.tool
setting.Create
difftool.sh
andmergetool.sh
in a directory referenced by your global environment variablePATH
. They will work even from DOS (and they aresh
-- shell -- scripts)difftool.sh
Notes:
Impossible to have -title1:"someTitle With Space"... only title without space does work..., so for now, try it without any 'titleN
' option.Got it! You cannot pass the title value directly to the
-title
option, you need to set it to a local variable, with"' '"
quotes combinations (the double quotes will disappear during the shell script execution, leaving the simple quotes, allowing spaces within a title!)$3
represent the real name and not some temporary file name for diff purpose. Hence the use of$3
within thetitle1
option, with space in it.git diff HEAD^ HEAD
would not work in DOS session: onlygit diff "HEAD^" HEAD
would.mergetool.sh
I am not sure I those scripts do work properly when multiple files are involved (multiple diffs, multiple files to be merged).Just tested it: it works, and Araxis compare.exe does open one tab per file to diff or merge.
Give it a try and let us know ;)
我认为你需要更加小心 .gitconfig 中的转义。
不幸的是,由于配置变量的扩展和评估方式,您的字符串需要是有效的 shell 命令,然后“git config”会被转义。
尝试这样的事情:
是的,不是很漂亮,我知道。 这是直接使用 git config 实际上更容易的情况之一。
I think that you need to be a bit more careful with your escaping in your .gitconfig.
Unfortunately, due to the way the config variable is expanded and evaled, your string needs to be an valid shell command which is then 'git config' escaped.
Try something like this:
Yes, not very pretty, I know. It's one of the cases where using
git config
directly is actually easier.我在这个问题上挣扎了很长一段时间,现在我终于可以说,所有建议的脏黑客(如中间 shell 脚本)都是不必要的 =D。 事实是,所有最新版本的 MSYSGit(我有 1.6.4)都开箱即用地支持 Araxis Merge(我有 2008)。 毫不奇怪,它在内部被称为“araxis”。 因此,您所需要做的就是
在
.gitconfig
中进行设置。 此外,您还必须将 Araxis 文件夹包含到 PATH 环境变量中(MSYSGit 查找Compare.exe
)。作为一个好的措施,您可以配置的与“araxis”mergetool 相关的其他 Git 设置(特别是,如果您恰好选择了该名称,就像本页上的一些人一样),应该全部删除。 这包括
[mergetool "araxis"]
部分下的所有内容。 请务必从所有配置(系统、全局和存储库)中删除它们,否则它们可能会干扰正常的“内部工具”行为。无论如何,如果您对 MSYSGit 如何启动 Araxis Merge 感兴趣,或者想知道它支持哪些其他开箱即用的合并工具,则可以查看
\share\git-gui\lib\mergetool.tcl MSYSGit 安装文件夹中的
脚本。附言。 您可以通过在
.gitconfig
中配置mergetool.araxis.path
来避免设置 PATH 环境变量。 就我个人而言,我从来没有费心这样做,因为.gitconfig
中指定目录路径(尤其是像"C:\Program Files\Araxis\Araxis Merge\"
这样包含空格的目录路径)可能很难正确完成,因为它很容易出现反斜杠/正斜杠问题,困扰着 MSYSGit。聚苯硫醚。 上述所有内容也适用于使 Araxis 成为您的 difftool。 也就是说,如果您的配置中有的话,您需要在
[difftool "araxis"]
部分中添加和删除其他任何内容(不过,不要忘记设置 PATH)。
I struggled with this problem for quite a while, and now I finally can say, that all suggested dirty hacks (like intermediate shell scripts) are rather unnecessary =D. Thing is, all of the latest versions of MSYSGit (I have 1.6.4) support Araxis Merge (I have 2008) out of the box. It comes at no surprise, that internally it's called "araxis". So, all that you need is to set
in your
.gitconfig
. Also you have to include Araxis folder into your PATH environment variable (MSYSGit looks forCompare.exe
).For a good measure, other Git settings related to "araxis" mergetool, that you could have configured (especially, if you happen to choose exactly that name, as did some people on this page), should all be removed. That includes everything under
[mergetool "araxis"]
section. Be sure to remove them from all configs (system, global, and repository), otherwise, they might interfere with normal "internal tool" behavior.In any case, if you're interested in how MSYSGit will start your Araxis Merge, or wondering what other mergetools it supports out of the box, the place to look is
\share\git-gui\lib\mergetool.tcl
script in your MSYSGit installation folder.PS. You might be able to avoid setting PATH environment variable, by configuring
mergetool.araxis.path
in.gitconfig
. Personally, I never bothered to do so, since.gitconfig
(especially the one like"C:\Program Files\Araxis\Araxis Merge\"
, which contains spaces) can prove hard to be done correctly, since it is prone to backslash/forwardslash issues, that plague MSYSGit.PPS. All of the above applies to making Araxis your difftool, too. I.e, you need to add
and remove anything else in
[difftool "araxis"]
section, if you have it in your config (don't forget to set up PATH, though).您可以尝试按照我的回答中提到的脚本进行操作diffMerge(适用于 Windows)并查看它是否有效。
可执行路径可以更好地表达为:
You could try to follow the script mentioned in my answer about diffMerge (for Windows) and see if it works.
The executable path could be better expressed with:
我发现“简单”地做到这一点的一种方法是安装 TortoiseGit 并设置 diff /合并 TortoiseGit 选项中的工具。
但是,如果您想与命令行进行比较,这并不能解决问题。
One way I found to do it "simply" is to install TortoiseGit and set the diff / merge tools in TortoiseGit options.
However, this does not address the issue if you want to diff from the command line.
由于我一直沉迷于定制的 git 差异/合并,我想我会尝试一劳永逸地解决这个问题。 我到达了 AraxisMerge 开始的地方,但没有选项卡的标题。 因此,这将作为读者的练习:)
观察和评论:
从 git-diff-driver.sh 开始给我带来了同样的错误。 将脚本更改为仅包含“echo”后,这并没有改变。 因此该错误与脚本的内容无关。
然后我从 .gitconfig 中删除了 '/bin' 部分,所以该行变成
......并且这开始工作:它开始合并,但它没有正确转义 '(repo) ' 部分。 作为一种解决方法,我让它在没有标题的情况下工作:
祝你好运!
Since I've been bitten to customised git differs/mergers, I thought I would try to fix this one for once and for all. I got to the point where AraxisMerge started, but without the titles of the tabs. So that will be left as an exercise for the reader :)
Observations and comments:
Starting with the git-diff-driver.sh gave the same error to me. After changing the script to only contain 'echo', this did not change. So the error is independent from the contents of the script.
Then I removed the '/bin' part from .gitconfig, so the line becomes
...and this started to work: it started the merger, but it does not escape the '(repo) ' part correctly. As a workaround I got it working without the titles with:
Good luck!