既有环境:
1)下载安装p4merge
2)安装git
下面是配置p4merge为git mergetool的步骤
1. /usr/local/bin下创建extMerge文件:
1 2 3 |
$ cat >> /usr/local/extMerge#!/bin/sh/Applications/IDE/p4merge.app/Contents/MacOS/p4merge $* |
2. /usr/local/bin下创建extDiff文件:
1 2 3 |
$ cat >> /usr/local/bin/extDiff#!/bin/sh[ $# -eq 7 ] && /usr/local/bin/extMerge "$2" "$5” |
3. extMerge和extDiff文件添加执行权限
1 2 |
$ sudo chmod +x /usr/local/bin/extMerge$ sudo chmod +x /usr/local/bin/extDiff |
4. 命令行配置本地git配置信息
1 2 3 4 5 6 7 8 9 10 11 |
$ 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$ git config -luser.name=YuzhuXu/徐玉珠user.email=timely.xyz@163.commerge.tool=extMergemergetool.extMerge.cmd= extMerge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"mergetool.trustexitcode=falsediff.external=extDiff |
5. 配置完后,检查.gitconfig文件
1 2 3 4 5 6 7 8 9 10 11 |
[user] name = YuzhuXu/徐玉珠 email = timely.xyz@163.com[merge] tool = extMerge[mergetool "extMerge"] cmd = " extMerge \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\""[mergetool] trustExitCode = false[diff] external = extDiff |
6. 检验一下。使用p4merge以后会生成xxx.backup, xxx.base, xxx.local, xxx.remote, xxx.orig, 以及merge之后的文件。
mac配置git mergetool为p4merge(2013笔记整理),布布扣,bubuko.com
mac配置git mergetool为p4merge(2013笔记整理)
原文:http://www.cnblogs.com/timelyxyz/p/3732790.html