随笔 - 298  文章 - 377  trackbacks - 0
<2016年6月>
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

常用链接

留言簿(34)

随笔分类

随笔档案

文章档案

相册

收藏夹

搜索

  •  

最新评论

阅读排行榜

评论排行榜

git mergetool默认提供的差异处理工具相当不顺手。
大家都知道Beyond Compare是一个非常好用的差异处理工具。
你可以把它设置成git mergetool默认提供的工具来提升你的工作效率。
Mac上需要在user目录下的.gitconfig文件中加入下面的配置:

  1. [diff]
  2.         tool = bcomp
  3. [difftool "bcomp"]
  4.         cmd = \"/usr/local/bin/bcomp\" \"$LOCAL\" \"$REMOTE\"
  5. [difftool]
  6.         prompt = false
  7. [merge]
  8.         tool = bcomp
  9. [mergetool]
  10.         prompt = false
  11. [mergetool "bcomp"]
  12.         cmd = \"/usr/local/bin/bcomp\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"
复制代码

然后安装BeyondCompore的Command line tools


使用Beyond Compare作为git mergetool的默认对比工具 For Linux:
http://bbs.mfunz.com/thread-659155-1-1.html

posted on 2016-06-17 23:47 聂文龙 阅读(2799) 评论(2)  编辑 收藏 引用

FeedBack:
# re: 使用Beyond Compare作为git mergetool的默认对比工具 For Mac 2016-06-17 23:52 聂文龙
这两天花了点时间终于在Window和Mac上把Beyong Compare和git整合好,其中遇到到很多坑,现在把这些都分享出来,希望对大家有帮助。
首先假设你已经装好了Beyong Compare。
然后在~/bin/目录下新建一个git-diff-wrapper.sh
window系统的git bash的git-diff-wrapper.sh
#!/bin/sh
# diff is called by git with 7 parameters:
# path old-file old-hex old-mode new-file new-hex new-mode
"D:/tools/Beyond Compare 2/BC2.exe" "$2" "$5" | cat
mac系统的git-diff-wrapper.sh
#/bin/sh
# diff is called by git with 7 parameters:
# path old-file old-hex old-mode new-file new-hex new-mode
bcompare "$2" "$5"|cat
注意:你在mac系统中装了beyong compare后需要在菜单栏点击“Install Command Line Tools”把它加入到命令行。
Beyond Compare Pro for Mac 4.0.2 破解版下载
在用户目录~下修改.gitconfig文件
[user]
name = hudashi
email = hudashi@gmail.com
[diff]
external = ~/bin/git-diff-wrapper.sh
最后就git diff就ok了。
注意:我们在Mac上运行git diff时,由于系统要保存历史文件到临时目录再进行比较,而在保存到临时目录又需要很高的权限。所以我在git diff前加了sudo才能执行成功。即sudo git diff.
关于git diff的更多内容请参考《git diff简介》  回复  更多评论
  
# re: 使用Beyond Compare作为git mergetool的默认对比工具 For Mac 2016-06-18 09:11 聂文龙
bash-3.2# find . -name "*.orig" -exec rm -rf {} \;
bash-3.2# find . -name "*_LOCAL_*" -exec rm -rf {} \;
bash-3.2# find . -name "*_BASE_*" -exec rm -rf {} \;
bash-3.2# find . -name "*_REMOTE_*" -exec rm -rf {} \;
bash-3.2# find . -name "*_BACKUP_*" -exec rm -rf {} \;  回复  更多评论
  

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理