所以我看到了一些关于让DiffMerge成为git的mergetool和difftool的问题。从本质上讲,它归结为在PATH中使用DiffMerge (sgdm.exe)和一个如下所示的.gitconfig:
[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当我运行git difftool file1 file2时,什么也没有发生。无错误代码,不启动DiffMerge。在Git Bash和Windows命令行中,我可以运行sgdm file1 file2,然后DiffMerge就会出现。
我已经修改了.gitconfig中的cmd,使其不具有路径或扩展名(例如,仅限sgdm ),但仍然无效。
有没有人遇到过这种情况?我有没有什么明显的遗漏?我觉得我漏掉了一些明显的东西。
发布于 2012-12-14 04:55:14
我使用SourceGear DiffMerge的.gitconfig是:
[mergetool "diffmerge"]
cmd = \"C:\\program files\\sourcegear\\common\\diffmerge\\sgdm.exe\" --merge --result=$MERGED $LOCAL $BASE $REMOTE(显然,如果您喜欢在另一边使用$LOCAL和$REMOTE,请将它们翻转过来。)
发布于 2013-03-21 03:34:13
这对我来说已经很好用了很长一段时间。(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发布于 2014-02-25 18:36:19
This为我工作:
C:\> git config --global diff.tool diffmerge
C:\> git config --global difftool.diffmerge.cmd
"C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe
\"$LOCAL\" \"$REMOTE\""
C:\> git config --global merge.tool diffmerge
C:\> git config --global mergetool.diffmerge.trustExitCode true
C:\> git config --global mergetool.diffmerge.cmd
"C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe
/merge /result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\""https://stackoverflow.com/questions/13868052
复制相似问题