How to use an external diff tool for Git in Visual Studio 2013?

白昼怎懂夜的黑 提交于 2019-12-03 08:17:43

Visual Studio uses the diff.tool configuration setting, not the diff.guitool configuration setting.

Try:

[diff]
    tool = TortoiseMerge

I have had the same issue recently in Visual Studio 2012. I will post the solution here as this is the first thread I found when searching.

My .gitconfig file looked like this:

[merge]
    tool = kdiff3
[diff]
    tool = kdiff3
[difftool]
    prompt = true

[difftool "kdiff3"]
    path = "C:/Program Files/KDiff3/kdiff3.exe"
    keepBackup = false
    trustExitCode = true
[mergetool]
    prompt = true

[mergetool "kdiff3"]
    cmd = "C:/Program Files/KDiff3/kdiff3.exe" $BASE $LOCAL $REMOTE -o $MERGED
    keepBackup = false
    trustExitCode = true

[mergetool "vsdiffmerge"]
    cmd = "C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsdiffmerge.exe" /m $REMOTE $LOCAL $BASE $MERGED
    keepbackup = false
    trustexistcode = true

The problem was the newlines between config sections.

Changing the file to this worked correctly:

[merge]
    tool = kdiff3
[diff]
    tool = kdiff3
[difftool]
    prompt = true
[difftool "kdiff3"]
    path = "C:/Program Files/KDiff3/kdiff3.exe"
    keepBackup = false
    trustExitCode = true
[mergetool]
    prompt = true
[mergetool "kdiff3"]
    cmd = "C:/Program Files/KDiff3/kdiff3.exe" $BASE $LOCAL $REMOTE -o $MERGED
    keepBackup = false
    trustExitCode = true
[mergetool "vsdiffmerge"]
    cmd = "C:/Program Files (x86)/Microsoft Visual Studio 12.0/Common7/IDE/vsdiffmerge.exe" /m $REMOTE $LOCAL $BASE $MERGED
    keepbackup = false
    trustexistcode = true
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!