git 调用 Beyond Compare

转载自  http://www.jackness.org/2015/03/31/git-%E8%B0%83%E7%94%A8-%E7%AC%AC%E4%B8%89%E6%96%B9%E5%AF%B9%E6%AF%94%E5%B7%A5%E5%85%B7beyondcompare/?utm_source=tuicool&utm_medium=referral

 

对于我这种 git 命令行小白来说, git 自带的对比工具各种水土不服,想念以前的 svn 小乌龟 + beyondCompare 的日子。。。纠结完 gitHub client 未果之后,终于研究到。。 原来 git 的对比也可以调用第三方工具的, well done!

下面来科普下 如果 在 git 设置 第三方对比工具。

配置 git

打开 .gitconfig 配置文件 (windows 在 C:\Users\Administrator [Administrator 为你当前用户名], mac 在 ~/),加入以下内容

[diff]

tool = bc3

[difftool "bc3"]

path = D:/Program Files (x86)/Beyond Compare 3/BCompare.exe

[merge]

tool = bc3

[mergetool "bc3"]

path = D:/Program Files (x86)/Beyond Compare 3/BCompare.exe

其中 path 为你 beyondCompare 的安装目录;

ok 搞好了, 让我们试试效果

打开你的git项目 目录输入

git difftool git difftool -t bc3

你会看到
git_beyond01

输入回车之后, ok beyondCompare 启动了~

(tips 如果不能调用 可以在 终端输入任意字母 如 m,就可以调用成功了)
git_beyond02.png

转载于:https://www.cnblogs.com/liaokang/p/6222539.html

### 使用 Beyond Compare 5 作为 Git 差异和合并工具 为了配置并使用 Beyond Compare 5 作为 Git 的差异和合并工具,需按照以下说明操作: #### 安装 Beyond Compare 首先下载并安装 Beyond Compare 软件[^2]。 #### 配置 Git 使用 Beyond Compare 完成软件安装之后,需要告诉 Git 如何调用 Beyond Compare 来处理文件之间的差异以及解决冲突。这可以通过设置环境变量或直接修改 `.gitconfig` 文件来实现。对于大多数用户来说,在命令行中执行如下指令即可全局应用这些更改: ```bash git config --global diff.tool bc git config --global merge.tool bc ``` 如果希望指定版本号(例如 BC5),可以这样写: ```bash git config --global diff.guitool "bc5" git config --global difftool.bc5.cmd "\"C:/Program Files/Beyond Compare 5/bcomp.exe\" \"$LOCAL\" \"$REMOTE\"" git config --global mergetool.bc5.cmd "\"C:/Program Files/Beyond Compare 5/bcomp.exe\" \"$LOCAL\" \"$BASE\" \"$REMOTE\" \"$MERGED\"" ``` 请注意路径应根据实际安装位置调整。 #### 查看文件差异 当想要查看特定文件相对于 `master` 分支的变化时,可运行如下命令: ```bash git difftool filename ``` 这条命令会启动 Beyond Compare 并显示两个版本之间存在的任何不同之处。 #### 解决冲突 遇到合并冲突的情况下,通过下面的命令可以帮助解决问题: ```bash git mergetool filename ``` 该命令同样打开 Beyond Compare 应用程序,允许手动编辑直至消除所有分歧为止。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值