码迷,mamicode.com
首页 > 其他好文 > 详细

mac配置git mergetool为p4merge(2013笔记整理)

时间:2014-05-17 21:41:46      阅读:354      评论:0      收藏:0      [点我收藏+]

标签:style   blog   class   code   c   ext   

既有环境:

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 -l
user.name=YuzhuXu/徐玉珠
user.email=timely.xyz@163.com
merge.tool=extMerge
mergetool.extMerge.cmd= extMerge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
mergetool.trustexitcode=false
diff.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之后的文件。

bubuko.com,布布扣

mac配置git mergetool为p4merge(2013笔记整理),布布扣,bubuko.com

mac配置git mergetool为p4merge(2013笔记整理)

标签:style   blog   class   code   c   ext   

原文地址:http://www.cnblogs.com/timelyxyz/p/3732790.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!