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

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


当前回答

在Windows 7上无以伦比

git config --global merge.tool bc3
git config --global mergetool.bc3.path "C:\Program Files (x86)\Beyond Compare 3\BCompare.exe"

其他回答

在Windows 7上无以伦比

git config --global merge.tool bc3
git config --global mergetool.bc3.path "C:\Program Files (x86)\Beyond Compare 3\BCompare.exe"

我找到了两种方法来配置“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'

如果从SourceTree打开p4merge有问题,请在MyRepo下查找名为config的本地配置文件。Git并删除任何合并配置。 在我的例子中,它试图打开我刚刚卸载的Meld

如果你通过cygwin来做这件事,你可能需要使用cygpath:

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