将diffmerge设置为可视化Git difftool不起作用 [英] Setting diffmerge as visual Git difftool not working

查看:306
本文介绍了将diffmerge设置为可视化Git difftool不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将DiffMerge配置为Git中的difftool,但没有运气。这是我的 .gitconfig 文件中令人惊叹的部分(其他设置未显示仅供用户使用)。

I am trying to configure DiffMerge as my difftool in Git but having no luck. This is the revelent section of my .gitconfig file (the other settings not shown are just for the user).

[diff]
        tool = diffmerge
[difftool "diffmerge"]
        cmd = \"C:\\Program Files\\SourceGear\\Common\\DiffMerge\\sgdm.exe\" \"$LOCAL\" \"$REMOTE\"

每当我从powershell命令行调用 git difftool 时,冲突都会直接显示在powershell界面的下方,而不是像预期的那样。我知道设置正在被git拾取,因为当我检查全局配置时,我会从配置文件中获得设置:

Whenever I call git difftool from the powershell command line the conflicts are shown directly beneath in the powershell interface, not in diffmerge as intended. I know the settings are being picked up by git because when I inspect the global config I am given the settings from the config file:

git config --global --get-all difftool.diffmerge.cmd
"C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe" "$LOCAL" "$REMOTE"

我正在运行powershell而不是git bash。这是因为我安装了github for windows,它提供了powershell作为git的外壳,所以我不需要安装bash(还)。 Git版本为1.7.11.msysgit.0。

I am running powershell and not git bash. This is because I installed github for windows which provided powershell as the shell for git so I have not needed to install bash (yet). Git version is 1.7.11.msysgit.0.

推荐答案

我被混淆了 difftool mergetool 。我需要使用 mergetool 来解决与视觉界面的冲突并保存结果。 difftool 只显示您的差异。请参阅 git-mergetool-vs-difftool 以进行说明。

I was getting mixed up with difftool and mergetool. I needed to be use mergetool to resolve conflicts with a visual inteface and save the results. difftool only shows you the differences. See git-mergetool-vs-difftool for clarification.

我将此部分添加到我的 .gitconfig 中,并从powershell命令行中调用 git mergetool

I added this section to my .gitconfig and called git mergetool from the powershell command line instead. Happy days.

[merge]
    tool = diffmerge
[mergetool "diffmerge"]
    cmd = \"C:\\Program Files\\SourceGear\\Common\\DiffMerge\\sgdm.exe\" --merge --result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"
    trustExitCode = true
    keepBackup = false

这篇关于将diffmerge设置为可视化Git difftool不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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