Setting diffmerge as visual Git difftool not working

孤街浪徒 提交于 2019-12-21 05:43:09

问题


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\"

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"

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.


回答1:


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.

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


来源:https://stackoverflow.com/questions/12175867/setting-diffmerge-as-visual-git-difftool-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!