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

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


当前回答

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

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

其他回答

新的git版本似乎直接支持p4merge,所以

git config --global merge.tool p4merge

如果p4merge.exe在你的路径上,这应该是你所需要的。不需要设置cmd或路径。

设置mergetool.p4merge。cmd将不再工作,因为Git已经开始尝试支持p4merge,请参阅libexec/ Git -core/ Git -mergetool——lib。所以我们只需要为git指定mergetool路径,例如p4merge:

git config --global mergetool.p4merge.path 'C:\Program Files\Perforce\p4merge.exe'
git config --global merge.tool p4merge

那么它就会起作用。

在Cygwin的指导下,唯一对我有用的是:

git config --global merge.tool myp4merge
git config --global mergetool.myp4merge.cmd 'p4merge.exe "$(cygpath -wla $BASE)" "$(cygpath -wla $LOCAL)" "$(cygpath -wla $REMOTE)" "$(cygpath -wla $MERGED)"'
git config --global diff.tool myp4diff
git config --global difftool.myp4diff.cmd 'p4merge.exe "$(cygpath -wla $LOCAL)" "$(cygpath -wla $REMOTE)"'

另外,我喜欢关闭difftool的提示信息:

git config --global difftool.prompt false

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

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

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