Git学习笔记5-difftool和mergetool设置

前言

在工作中,使用 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

猜你喜欢

转载自www.cnblogs.com/Mike2019/p/11986294.html