我在Cygwin上尝试了msysGit和Git。两者本身都工作得很好,并且都能完美地运行gitk和git-gui。

现在我该如何配置合并工具呢?(Vimdiff在Cygwin上工作,但我更希望能有一个对我们一些喜欢windows的同事更友好的东西。)


当前回答

要设置p4merge,使用chocoley在窗口上安装merge和diff,请看这里: https://gist.github.com/CamW/88e95ea8d9f0786d746a

其他回答

要设置p4merge,使用chocoley在窗口上安装merge和diff,请看这里: https://gist.github.com/CamW/88e95ea8d9f0786d746a

呸,这终于为我工作(Windows 7 + Cygwin + TortoiseMerge):

在. /配置:

cmd = TortoiseMerge.exe /base:$(cygpath -d \"$BASE\") /theirs:$(cygpath -d \"$REMOTE\") /mine:$(cygpath -d \"$LOCAL\") /merged:$(cygpath -d \"$MERGED\")

感谢之前的海报为提示使用cygpath!

我找到了两种方法来配置“SourceGear DiffMerge”作为difftool和github Windows中的mergetool。

命令提示符窗口中的以下命令将更新你的.gitconfig以配置GIT使用DiffMerge:

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.cmd  'C:/Program\ Files/SourceGear/Common/DiffMerge/sgdm.exe  -merge  -result=\"$MERGED\" \"$LOCAL\" \"$BASE\" \"$REMOTE\"'

[OR]

将以下行添加到.gitconfig中。这个文件应该在你的主目录C:\Users\UserName:

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

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

我不得不在windows 7上使用msysGit删除额外的引用,不知道为什么。

git config --global merge.tool p4merge
git config --global mergetool.p4merge.cmd 'p4merge $BASE $LOCAL $REMOTE $MERGED'

你可能也想添加这些选项:

git config --global merge.tool p4mergetool
git config --global mergetool.p4merge.cmd 'p4merge $BASE $LOCAL $REMOTE $MERGED'
git config --global mergetool.p4mergetool.trustExitCode false
git config --global mergetool.keepBackup false

另外,我也不知道为什么,但是米兰·加迪安的回答把我搞砸了。