git 设置 mergetool,difftool 为 BeyondCompare

卖一下广告,欢迎大家关注我的微信公众号,扫一扫下方二维码或搜索微信号 stormjun,即可关注。 目前专注于 Android 开发,主要分享 Android开发相关知识和一些相关的优秀文章,包括个人总结,职场经验等。

前言

在工作中,使用 git 的时候,我们大多数情况下都会使用一些可视化工具,比如 TortoiseGit,SourceTree 等等。但是,有时候,我们也会使用 git 命令行,比如结合 gerrit 使用的时候。今天,我们就来说说怎样配置 git 的 mergetool,difftool,一共有两种方式。

第一种方法

使用命令行配置:

windows

difftool

git config --global diff.tool bc3 
git config --global difftool.bc3.path "bcomp.exe的路径"

mergetool

git config --global merge.tool bc3 
git config --global mergetool.bc3.path "bcomp.exe的路径"

举个例子,比如我电脑 bcomp.exe的路径 为 D:\Program Files (x86)\Beyond Compare 3\BComp.exe,那么我可以这样配置

git config --global merge.tool bc3 
git config --global mergetool.bc3.path "D:\\Program Files (x86)\\Beyond Compare 3\\BComp.exe"

第二种方法

直接在 gitconfig 文件配置,可以在 C:\Users{UserName}.gitconfig 文件中配置。如果想要了解更多 gitConfig ,可以阅读我的这一篇博客 Git config 使用说明

[merge]
    tool = bc3
[mergetool "bc3"]
    path = D:\\Program Files (x86)\\Beyond Compare 3\\BComp.exe
[diff]
    tool = bc3
[difftool "bc3"]
    path = D:\\Program Files (x86)\\Beyond Compare 3\\BComp.exe

猜你喜欢

转载自blog.csdn.net/gdutxiaoxu/article/details/80455810
今日推荐