Windows下使用Beyond Compare作为git的比对与合并工具
来源:互联网 发布:第七感大底软件 编辑:程序博客网 时间:2024/05/18 02:53
在使用Git进行合并的时候苦于没有合适的工具,在网上不小心看见的。Beyond Compare在电脑里装了这么多年,才发现还有这样的黑科技技能。
介绍
其实各种git的GUI客户端都有自带比对工具,但是一开始学Git的时候,用的是Windows下的Git Bash,后来也渐渐熟悉各种命令,用图形客户端反而不习惯了。 这里介绍如何将Beyond Compare配置为git的difftool和mergetool。当需要比对或者合并冲突时,就可以通过difftool和mergetool调用Beyond Compare进行比对和合并冲突了。
操作
目前我电脑里安装的是Beyond Compare 4,就介绍一下4的设置,Beyond Compare 3也是类似的。
其实Beyond Compare官网就有介绍 如何配置git的difftool和mergetool,其实就几行git命令。
#difftool 配置git config --global diff.tool bc4 git config --global difftool.bc4.cmd "\"c:/program files (x86)/beyond compare 4/bcomp.exe\" \"$LOCAL\" \"$REMOTE\"" #mergeftool 配置 git config --global merge.tool bc4 git config --global mergetool.bc4.cmd "\"c:/program files (x86)/beyond compare 4/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"" git config --global mergetool.bc4.trustExitCode true
但是我照着上面的步骤配置,使用difftool命令后,发现左右两边都为空白文件。研究了半天没研究出个所以然。 后来突然想起来用户目录下的.gitconfig看看配置情况,才发现原因。 打开配置文件看到的信息差不多是这样: [diff] tool = bc4 [difftool] prompt = false [difftool "bc4"] cmd = \"c:/program files (x86)/beyond compare 4/bcomp.exe\"
使用git bash是执行上述几个命令后,.gitconfig文件中并没有 \”
.gitconfig文件新增如下配置并保存
[diff] tool = bc4[difftool] prompt = false[difftool "bc4"] cmd = "\"c:/program files (x86)/beyond compare 4/bcomp.exe\" \"$LOCAL\" \"$REMOTE\"" [merge] tool = bc [mergetool] prompt = false [mergetool "bc4"] cmd = "\"c:/program files (x86)/beyond compare 4/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\""
然后在git命令行中执行相关命令就ok啦:)
#比对当前文件相对于Head版本的改动git difftool <file_name>#当merge <branch_name>提示冲突时,执行下面命令便可以调出bc合并冲突git mergetool
- Windows下使用Beyond Compare作为git的比对与合并工具
- Windows下使用Beyond Compare作为git的比对与合并工具
- Windows下使用Beyond Compare作为git的比对与合并工具
- Beyond Compare作为git的比对与合并工具
- Git使用Beyond Compare作为比对合并工具
- Git下使用Beyond Compare作为比较和合并工具
- Git下使用Beyond Compare作为比较和合并工具
- Git下使用Beyond Compare作为比较和合并工具
- 使用Beyond Compare作为git mergetool的默认对比工具
- Beyond Compare 比对工具
- git 在 windows上自定义比较、合并工具(Beyond Compare)
- Beyond Compare比对工具安装问题解决
- mac 文件比对工具 Beyond Compare
- ubuntu使用meld/beyond compare 做git的diff工具
- TortoiseSVN使用Beyond Compare 3作为compare和merge的外部工具
- git使用beyond compare
- git 使用beyond compare 的配置方法
- Windows下设置git对比和合入工具为beyond compare
- ZOJ 1610 Count the Colors 多次更新一次查询,只需要一一标记
- hdu 5667 矩阵快速幂
- BNUOJ-4716题 IQ test
- Oracle以及SqlServer 2008 查询表是否存在
- BestCoder Round #81 (div.2)-Matrix(模拟)
- Windows下使用Beyond Compare作为git的比对与合并工具
- 牛腩新闻发布系统——用例图知识,温故知新
- Android Studio2.0在Android5.0以下机型无法调试
- HDU 5671 矩阵的交换行、交换列,整行加一个数 思维题
- Android - View的绘制流程二(layout)
- 【Raspberry Pi 3试用体验】+ 中文显示及输入+百度云传输
- 康托展开入门
- JDBC01
- Java遍历容器注意问题