git调用beyond Compare

觉得GIT的对比工具有点不太直观,都是命令行(采用git diff指令)的。

于是我查看了这个文章https://www.cnblogs.com/outs/p/6118219.html

就是在git里输入命令

git config --global diff.tool bc2
git config --global difftool.bc2.path "I:\git\Beyond Compare 2\BC2.exe"

然后输入
$ git diff  ee46bda  1c73ba45
结果出现了

git config option diff.tool set to unknown tool: bc2
Resetting to default...


This message is displayed because 'diff.tool' is not configured.
See 'git difftool --tool-help' or 'git help config' for more details.
'git difftool' will now attempt to use one of the following tools:
opendiff kdiff3 tkdiff xxdiff meld kompare gvimdiff diffuse diffmerge ecmerge p4merge araxis bc codecompare emerge vimdiff

Launch 'vimdiff' [Y/n]?

然后我点击Y,出现了花花绿绿的界面。界面还可以,不过感觉不如BEyong compare ,毕竟用习惯了beyond compare吧。
然后我输入:
$ git difftool --tool-help
出现了:

'git difftool --tool=<tool>' may be set to one of the following:
                vimdiff
                vimdiff2
                vimdiff3


The following tools are valid, but not currently available:
                araxis
                bc
                bc3
                codecompare
                deltawalker
                diffmerge
                diffuse
                ecmerge
                emerge
                examdiff
                gvimdiff
                gvimdiff2
                gvimdiff3
                kdiff3
                kompare
                meld
                opendiff
                p4merge
                tkdiff
                winmerge
                xxdiff


Some of the tools listed above only work in a windowed
environment. If run in a terminal-only session, they will fail.
就是说支持bc3,不支持bc2.怪不得bc2不好用。

然后我输入(这里有
疑问】,输入的git config --global指令改变的文件在哪里)
$ git config --global diff.tool bc3
$ git config --global difftool.bc3.path '/i/git/Beyond Compare 3/BCompare.exe'

然后输入$ git difftool 747de 1c73ba
出现了
Viewing (1/5): '**********.c'
Launch 'bc3' [Y/n]? y
看出来了吧,调用成功了。有5个文件不同,看样子是一个一个比较。
估计还有别的指令可以一起比较。

现在还解决上面的那个【疑问】,于是输入
$ git config --list
果然出现的内容包括了CM3相关:
diff.tool=bc3
difftool.bc2.path=I:/git/Beyond Compare 2/BC2.exe
difftool.bc3.path=I:/git/Beyond Compare 3/BCompare.exe
看样子BC2的配置也配置了,就是这个版本的git不支持罢了。

调用了BC3软件后,发现被比较的C文件放在了H:\Users\***\AppData\Local\Temp\
这个目录下,直接生成了临时的C文件源码。注意这个是个temp文件,就是可以考虑随时删除的。
所以是要注意你整个开发过程中的源码在Temp文件下也会存在的。
这可能是调用Beyond Compare要付出的代价!

所以可以猜测一下,调用beyond compare同时比较所有的文件的这种指令不见得存在。如果同时比较,就需要把所有的文件统统放到TEMP文件下下面。
所以可以考虑手动比较,就是先把工程下所有文件备份一下,然后用git reset指令把版本还原回去,然后再手动调用beyond compare比较。

附录:
文中【疑问】解决了:
找到了,在H:\Users\****\路径下,
文件的名字是
.gitconfig,
里面内容是

[user]
	name = *****
	email = *****
[core]
	editor = notepad++
[diff]
	tool = bc3
[difftool "bc2"]
	path = I:/git/Beyond Compare 2/BC2.exe
[difftool "bc3"]
	path = I:/git/Beyond Compare 3/BCompare.exe


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值