git 在 windows上自定义比较、合并工具(Beyond Compare)

本文介绍了如何在Windows环境下将BeyondCompare与Git进行集成配置,实现文件比较与合并功能。通过具体的命令设置,用户可以方便地利用BeyondCompare进行Git工作流中的差异查看及三向合并操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在windows上就选Beyond Compare来作比较和合并工具吧。

Beyond Compare官方给出来多个版本工具的配置方案。

[url]http://www.scootersoftware.com/support.php?c=kb_vcs.php[/url]

Git for Windows

Note: If you use the Git for Windows' Bash Command Prompt instead of the default Windows Command Prompt, you need to escape the $ character with *\$*.

Diff
At a command prompt enter the commands:
git config --global diff.tool bc3
git config --global difftool.bc3.cmd "\"c:/program files/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\""
git config --global difftool.prompt false

To launch a diff with BC3, use the command "git difftool foofile.txt".

3-Way Merge (v3 Pro)
At a command prompt, enter the commands:
git config --global merge.tool bc3
git config --global mergetool.bc3.cmd "\"c:/program files/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\""
git config --global mergetool.bc3.trustExitCode true

To launch a 3-way merge with BC3, use the command "git mergetool foofile.txt".

需要注意的是在配置
git config --global difftool.bc3.cmd "\"c:/program files/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\""



git config --global mergetool.bc3.cmd "\"c:/program files/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\""

这个的时候会丢失 $引用的变量,所以最好还是检查一下配置文件的配置是否正确。

我的配置文件:

[user]
name = liujiuwu
email = liujiuwu@gmail.com
[color]
diff = auto
status = auto
branch = auto
[alias]
st = status
rb = svn rebase
ci = commit -a
co = checkout
[diff]
tool = bc3
[difftool "bc3"]
cmd = \"c:/program files/Beyond Compare 3/BComp.exe\" \"$LOCAL\" \"$REMOTE\"
[difftool]
prompt = false
[merge]
tool = bc3
[mergetool "bc3"]
cmd = \"c:/program files/Beyond Compare 3/BComp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"
trustExitCode = true
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值