git 使用Beyond Compare比较差异和合并冲突

2,890

一、安装Beyond Compare

  • 根据特定的操作系统选择安装包,下载地址:http://www.scootersoftware.com/download.php

二、安装命令行工具

  • 安装完成,启动Beyond Compare,转到Beyond Compare菜单并运行
    Install Command Line Tools

三、配置

1、Git 2.3和更新版本

(注意:
bc3
在BC版本4的命令行中
使用
。由Linux的git legacy支持引起。)

启动Beyond Compare,转到Beyond Compare菜单并运行
Install Command Line Tools

DIFF

在终端:

git config --global diff.tool bc3

要使用Beyond Compare启动差异,请使用以下命令:
git difftool file.ext

合并

在终端:

git config --global merge.tool bc3
git config --global mergetool.bc3.trustExitCode true

要使用Beyond Compare启动3向合并,请使用以下命令:
git mergetool file.ext


2、旧版本的Git

  1. 启动Beyond Compare,转到Beyond Compare菜单并运行
    Install Command Line Tools。
  2. 将以下行添加到
    $HOME/.gitconfig:

    [diff]
    tool = bcomp
    [difftool]
    prompt = false
    [difftool "bcomp"]
    trustExitCode = true
    cmd = "/usr/local/bin/bcomp" \"$LOCAL\" \"$REMOTE\"
    [merge]
    tool = bcomp
    [mergetool]
    prompt = false
    [mergetool "bcomp"]
    trustExitCode = true
    cmd = "/usr/local/bin/bcomp" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"
  3. 要在Beyond Compare中启动差异,请使用:
    git difftool file.ext
    要在Beyond Compare中启动合并,请使用:
    git mergetool file.ext