为什么我不能在Windows上使用TortoiseMerge作为我的git合并工具? [英] Why can't I use TortoiseMerge as my git merge tool on Windows?

查看:419
本文介绍了为什么我不能在Windows上使用TortoiseMerge作为我的git合并工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图执行我的第一个Git合并(令人兴奋!),但无法让Git Gui(Git 1.7.4.msysgit.0中的0.13.GITGUI)识别TortoiseMerge(1.6.11.20210 x64) Windows 7.根据答案类似的问题,我做了以下配置更改:

  $ git config --global merge.tool tortoisemerge 
$ git config --global mergetool.tortoisemerge.cmd'TortoiseMerge.exe -base:$ BASE-mine:$ LOCAL - 他们:$ REMOTE - 合并:$ 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
[mergetooltortoisemerge]
cmd = TortoiseMerge.exe -base:\$ BASE \-mine:\$ LOCAL \ - 他们:\$ REMOTE \ - 合并:\$ MERGED \

更新



从命令运行 git mergetool 时,TortoiseMerge可以正常使用上述配置线。看来只有Git Gui有问题。 : - /

解决方案

更新


$ b

原来的答案已经过时。



如果你有最新的git,只需做一次 git config merge.tool tortoisemerge



重要提示:不要将 .exe 扩展名添加到
$ b ===原创答案(现已过时)===



我没有tortoisemerge安装,所以我不能测试这个,但我敢肯定问题是,git gui使用一个名为C:\ Program Files(x86)\Git\share\ git-gui\lib\mergetool.tcl来定义它的每个合并工具,并且它显示了.gitconfig中定义的合并工具的不支持的合并工具错误,这些合并工具与mergetool中定义的合并工具中的一个不匹配。 tcl。

所以,为了使它工作,你应该能够像这样添加到mergetool.tcl:

  tortoisemerge {
set cm dline [list TortoiseMerge.exe -base:$ BASE-mine:$ LOCAL-theirs:$ REMOTE-merged:$ MERGED]
}



将新的tortoisemerge条目放在这个其他代码之上:

  error_popup [mc不支持的合并工具'%s'$ tool
return
}


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. :-/

解决方案

UPDATE:

The original answer is now obsolete.

If you have the latest git just do a one-time git config merge.tool tortoisemerge

Important: do not add a .exe extension to the command.

=== original answer (now outdated) ===

I don't have tortoisemerge installed so I can't test this, but I'm pretty sure the problem is that git gui uses a file called C:\Program Files (x86)\Git\share\git-gui\lib\mergetool.tcl to define each merge tool it works with, and it shows that "Unsupported merge tool" error for merge tools defined in .gitconfig that don't match one of the ones defined in mergetool.tcl.

So, to make it work, you should be able to add something like this to mergetool.tcl:

tortoisemerge {
    set cmdline [list TortoiseMerge.exe -base:"$BASE" -mine:"$LOCAL" -theirs:"$REMOTE" -merged:"$MERGED"]
}

Put the new tortoisemerge entry above this other code:

default {
        error_popup [mc "Unsupported merge tool '%s'" $tool]
        return
}

这篇关于为什么我不能在Windows上使用TortoiseMerge作为我的git合并工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆