Git + BeyondCompare

Mac 环境:

1. 安装 BeyondCompare

2. 配置 ~/.gitconfig

[diff]
    tool = bcomp
[merge]
    tool = bcomp
[difftool "bcomp"]
    cmd = /usr/local/bin/bcomp $LOCAL $REMOTE
    trustExitCode = true
[mergetool "bcomp"]
    cmd = /usr/local/bin/bcomp $LOCAL $REMOTE $BASE $MERGED
    trustExitCode = true

3. 加个软链

$ ln -s /Applications/Beyond\ Compare.app/Contents/MacOS/bcomp /usr/local/bin/

4. 使用(如果 merge 时有冲突)

$ git merge develop
$ git mergetool

5. SourceTree 配置 BeyondCompare

SourceTree -> Preferences -> Diff -> External Diff/Merge

参数:

Visual Diff Tool: Custom

Diff Command: /usr/local/bin/bcomp

Arguments: $LOCAL $REMOTE

Merge Tool: Custom

Diff Command: /usr/local/bin/bcomp

Arguments: $LOCAL $REMOTE $BASE $MERGED

6. 我的 .gitconfig 配置文件:

[user]
	name = xxx
	email = xxx@xx.cn
[core]
	excludesfile = /Users/yamei/.gitignore_global
[diff]
	tool = bcomp
[merge]
	tool = bcomp
[alias]
	st = status -s
	ci = commit
	l = log --oneline --decorate -13
	ll = log --oneline --decorate
	co = checkout
	br = branch
	rb = rebase
	dci = dcommit
[difftool "bcomp"]
	cmd = /usr/local/bin/bcomp $LOCAL $REMOTE
    trustExitCode = true
[mergetool "bcomp"]
	cmd = /usr/local/bin/bcomp $LOCAL $REMOTE $BASE $MERGED
    trustExitCode = true
[difftool "sourcetree"]
	cmd = /usr/local/bin/bcomp $LOCAL $REMOTE
	path = 
[mergetool "sourcetree"]
	cmd = /usr/local/bin/bcomp $LOCAL $REMOTE $BASE $MERGED
	trustExitCode = true

  

 

posted @ 2016-10-24 18:37  xngeer  阅读(1111)  评论(0编辑  收藏  举报