为什么我不能在 Windows 上使用 TortoiseMerge 作为 git 合并工具?
我正在尝试执行我的第一次 Git 合并(令人兴奋!),但无法让 Git Gui(来自 Git 1.7.4.msysgit.0 的 0.13.GITGUI)识别 Windows 7 上的 TortoiseMerge (1.6.11.20210 x64)。基于类似问题的答案,我进行了以下配置更改:
$ git config --global merge.tool tortoisemerge
$ git config --global mergetool.tortoisemerge.cmd 'TortoiseMerge.exe -base:"$BASE" -mine:"$LOCAL" -theirs:"$REMOTE" -merged:"$MERGED"'
$ git config --global --list
...snip...
merge.tool=tortoisemerge
mergetool.tortoisemerge.cmd=TortoiseMerge.exe -base:"$BASE" -mine:"$LOCAL" -theirs:"$REMOTE" -merged:"$MERGED"
$
不幸的是,当我启动 Git Gui 并尝试“运行合并工具”时,我收到错误不支持的合并工具“tortoisemerge”
。
谁能告诉我我做错了什么?以下是我的 ~/.gitconfig
的相关部分:
[merge]
tool = tortoisemerge
[mergetool "tortoisemerge"]
cmd = TortoiseMerge.exe -base:\"$BASE\" -mine:\"$LOCAL\" -theirs:\"$REMOTE\" -merged:\"$MERGED\"
Update
从命令行运行 git mergetool
时, TortoiseMerge 可以与上述配置正常配合。似乎只有 Git Gui 有问题。 :-/
I'm trying to perform my first Git merge ever (exciting!), but can't get Git Gui (0.13.GITGUI from Git 1.7.4.msysgit.0) to recognize TortoiseMerge (1.6.11.20210 x64) on Windows 7. Based on an answer to a similar question, I've made the following configuration changes:
$ git config --global merge.tool tortoisemerge
$ git config --global mergetool.tortoisemerge.cmd 'TortoiseMerge.exe -base:"$BASE" -mine:"$LOCAL" -theirs:"$REMOTE" -merged:"$MERGED"'
$ git config --global --list
...snip...
merge.tool=tortoisemerge
mergetool.tortoisemerge.cmd=TortoiseMerge.exe -base:"$BASE" -mine:"$LOCAL" -theirs:"$REMOTE" -merged:"$MERGED"
$
Unfortunately, when I start Git Gui and attempt to "Run Merge Tool", I receive the error Unsupported merge tool 'tortoisemerge'
.
Can anyone tell me what I've done wrong? Here's the relevant sections of my ~/.gitconfig
:
[merge]
tool = tortoisemerge
[mergetool "tortoisemerge"]
cmd = TortoiseMerge.exe -base:\"$BASE\" -mine:\"$LOCAL\" -theirs:\"$REMOTE\" -merged:\"$MERGED\"
Update
TortoiseMerge works fine with the above config when running git mergetool
from the command line. It seems that only Git Gui has problems with it. :-/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您有最新的 git,请运行此命令行一次:
git config merge.tool tortoisemerge
重要: 不要添加
.exe
扩展名命令。如果失败,或者如果您想添加 git 不知道的其他合并工具,请执行以下操作:
在编辑器中打开以下其中一项:
C:\Program Files\Git\ mingw64\share\git-gui\lib\mergetool.tcl
C:\Program Files (x86)\Git\share\git-gui\lib\mergetool.tcl
>将如下内容添加到 mergetool.tcl:
将新的 tortoisemerge 条目放在此其他代码之上:
额外示例:
要使用 SourceGear diffmerge,请将其添加到 mergetool.tcl:
If you have the latest git, run this command line once:
git config merge.tool tortoisemerge
Important: Do not add a
.exe
extension to the command.If that fails, or if you want to add a different merge tool that git doesn't know about, do this:
Open one of the following in an editor:
C:\Program Files\Git\mingw64\share\git-gui\lib\mergetool.tcl
C:\Program Files (x86)\Git\share\git-gui\lib\mergetool.tcl
Add something like this to mergetool.tcl:
Put the new tortoisemerge entry above this other code:
Bonus example:
To use SourceGear diffmerge, add this to mergetool.tcl:
试试这个:
来源:http://programmersunlimited.wordpress .com/2010/07/01/getting-git-to-use-tortoisemerge/
Try this:
Source: http://programmersunlimited.wordpress.com/2010/07/01/getting-git-to-use-tortoisemerge/
对于我正在处理的情况,mergetool已经设置为tortoisemerge,但它找不到它。
提供在 Windows 中工作的完全合格的位置:
For the case that I was working on, the mergetool was already set to tortoisemerge, but it could not find it.
Providing a fully qualified location worked in Windows:
尝试从命令行输入
TortoiseMerge.exe
以确保它位于路径中。如果没有通过“我的电脑”> 添加它属性>高级>环境变量>系统变量:路径。然后从命令提示符通过以下命令配置它
要从命令提示符使用它,请在 git 工作目录中键入 git difftool 。
它一次显示一个文件,所以你最好安装 TortoiseGit,这使得事情更容易处理,即使只是为了差异部分。
Try typing
TortoiseMerge.exe
from the command line to make sure it's in the path. If not add it via My Computer > Properties > Advanced > Environment Variables > System Variables:Path.Then from command prompt configure it via the following commands
To use it from the command prompt, type
git difftool
from your within your git working directory.It shows the files one at a time so you're still better off installing TortoiseGit which makes things easier to handle, even if just for the diff part.
这个问题似乎在最新的 git 中已得到解决(我有 git 版本 1.9.4.msysgit.1 )。
This issue appears resolved in the latest git (I have
git version 1.9.4.msysgit.1
).