ubuntu linux 配置 git 外部diff merge 工具 p4merge

1.安装p4merge:

下载地址:http://www.perforce.com/perforce/products/merge.html

下载得到p4v.gz

解压得到两个文件夹bin和lib,将这两个文件夹覆盖到/usr 目录(使用管理员权限)

2.根据prgit.pdf说明,进行配置(第161页),以下是我配置的结果都是都是Shell代码(需要管理员权限):

  文件名:extDiff

   存放路径:/usr/local/bin/extDiff

   文件内容:

#!/bin/bash
/usr/bin/p4merge "$2" "$5"

 确保文件可运行:

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

 最后编辑~/.gitconfig:

扫描二维码关注公众号,回复: 1163909 查看本文章

 

[diff]
	external = extDiff
[gui]
	spellingdictionary = none
[mergetool]
	trustExitCode = false
[merge]
	tool = p4merge
[mergetool "p4merge"]
	cmd = p4merge \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"

 
配置完成
windows 用户:
    安装参考:
    配置参考:
git config --global merge.tool p4merge
git config --global mergetool.p4merge.cmd 'p4merge.exe \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"'
 


猜你喜欢

转载自hexlee.iteye.com/blog/905682