Mik*_*enn 39
这对我在Windows 7上使用msysGit很有用:
git config --global merge.tool p4merge
git config --global mergetool.p4merge.cmd 'p4merge $BASE $LOCAL $REMOTE $MERGED'
Run Code Online (Sandbox Code Playgroud)
不知道为什么,但引用搞砸了我.
您将在此处看到我的DiffMerge或KDiff3配置.
基于此,我建议使用p4merge:
git config --global merge.tool merge
git config --global mergetool.merge.cmd "merge.sh \"$PWD/$LOCAL\" \"$PWD/$BASE\" \"$PWD/$REMOTE\" \"$PWD/$MERGED\""
Run Code Online (Sandbox Code Playgroud)
并且merge.sh
是一个包装器(复制在PATH
环境变量引用的目录中),能够考虑不BASE
存在的情况.
(当在两个不同的分支中创建文件然后合并时,该文件将没有共同的祖先)
#!/bin/sh
# Passing the following parameters to mergetool:
# local base remote merge_result
alocal=$1
base=$2
remote=$3
result=$4
if [ -f $base ]
then
p4merge.exe -dl "$base" "$alocal" "$remote" "$result"
else
p4merge.exe -dl "$result" "$alocal" "$remote" "$result"
fi
Run Code Online (Sandbox Code Playgroud)
你可能会注意到:
PWD
在合并的配置merge
"作为merge.tool名称的名称(因为在merge.sh
脚本中调用实际工具,您可以在任意数量的合并工具之间切换)$base
,$alocal
,$remote
,$result
在脚本中刚刚测试过它(事实证明,即使您没有安装任何其他P4产品,您也可以下载并仅安装p4merge - 客户端/可视化合并工具部分).
使用上面描述的设置,MSysGit1.6.3,DOS会话或Git bash会话:
它只适用于TM.
更新msysgit 1.7.x
Benjol在评论中提到:
现在,msysgit本身支持p4merge.
这意味着你可以这样做:
git config --global merge.tool p4merge
# and I recommend
git config --global mergetool.keepBackup false
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
18164 次 |
最近记录: |