OSX下git diff/merge 可视化工具 P4Merge 环境配置步骤

下载

step1:首先,把要运行的命令放入外部包装脚本中,创建一个merge包装脚本,名字叫做extMerge,让它带参数调用P4Merge。

$ cat >> /usr/local/bin/extMerge
#!/bin/sh
/Applications/p4merge.app/Contents/MacOS/p4merge $*

step2:再来创建一个名字为extDiff的脚本。

$ cat >> /usr/local/bin/extDiff 
#!/bin/sh
[ $# -eq 7 ] && /usr/local/bin/extMerge "$2" "$5"

step3:更改权限,使这两个脚本可执行

$ sudo chmod +x /usr/local/bin/extMerge 
$ sudo chmod +x /usr/local/bin/extDiff

step4:接下来在git里配置自定义的diff和merge工具。退出root用户,在本地用户下,执行下面命令 。

$ git config --global merge.tool extMerge
$ git config --global mergetool.extMerge.cmd \'extMerge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"'
$ git config --global mergetool.trustExitCode false
$ git config --global diff.external extDiff

  

posted @ 2015-07-19 16:40  Joerias  阅读(392)  评论(0编辑  收藏  举报