如何让DiffMerge配置为在Windows 7或Windows 2012上使用Git?

Dav*_*ter 11 git diffmerge

所以,我已经看到了有关获取DiffMerge是几个问题mergetool,并difftool为饭桶.从本质上讲,它归结为你的PATH和一个.gitconfig看起来像的DiffMerge(sgdm.exe):

[diff]
    tool = DiffMerge
[difftool "DiffMerge"]
    cmd = 'C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe' "$LOCAL" "$REMOTE"
[merge]
    tool = DiffMerge
[mergetool "DiffMerge"]
    cmd = 'C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe' -merge -result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"
    trustExitCode = true
    keepBackup = false
Run Code Online (Sandbox Code Playgroud)

当我跑步时git difftool file1 file2,没有任何反应.没有错误代码,也没有启动DiffMerge.从Git Bash和Windows命令行,我可以运行sgdm file1 file2并且出现DiffMerge.

我已经修改了cmd.gitconfig不具有路径或扩展名(如sgdm只),但仍无济于事.

有没有遇到过这个?有什么明显的东西我不见了吗?我觉得我错过了一些明显的东西.

Edw*_*son 13

.gitconfig使用SourceGear DiffMerge是:

[mergetool "diffmerge"]
cmd = \"C:\\program files\\sourcegear\\common\\diffmerge\\sgdm.exe\" --merge --result=$MERGED $LOCAL $BASE $REMOTE
Run Code Online (Sandbox Code Playgroud)

(显然,翻转$LOCAL,$REMOTE如果你喜欢它们在另一边.)


小智 8

以下为我工作-

git config --global diff.tool diffmerge
git config --global difftool.diffmerge.cmd 'C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe "$LOCAL" "$REMOTE"'
git config --global merge.tool diffmerge
git config --global mergetool.diffmerge.trustExitCode true
git config --global mergetool.diffmerge.cmd 'C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe -merge -result="$MERGED" "$LOCAL" "$BASE" "$REMOTE"'


Joh*_*her 5

这对我来说很有效.(Windows 7,Git的最新版本.)

确保sgdm.exe位于环境路径中.

[diff]
    tool = sgdm
[difftool "diffmerge"]
    cmd = sgdm $LOCAL $REMOTE
[merge]
    tool = sgdm
[mergetool "diffmerge"]
    cmd = sgdm --merge --result=$MERGED $LOCAL $BASE $REMOTE
    trustexitcode = false
[difftool "sgdm"]
    cmd = sgdm $LOCAL $REMOTE
[mergetool "sgdm"]
    trustexitcode = false
    cmd = sgdm --merge --result=$MERGED $LOCAL $MERGED $REMOTE --title1=Mine --title2='Merged: $MERGED' --title3=Theirs
Run Code Online (Sandbox Code Playgroud)