首先输入下述指令查看自己的git版本支持哪些工具

git difftool --tool-help

git mergetool --tool-help

bc3,bc4,代表的就是beyond compare,如果没有的话就升级git版本吧

git bash中输入下述指令,换成你自己的文件路径,注意是BComp.exe不是BCompare.exe

git config --global diff.tool bc4

git config --global difftool.bc4.cmd '"E:\Program Files\Beyond Compare\BComp.exe" "$LOCAL" "$REMOTE"'

git config --global merge.tool bc4

git config --global mergetool.bc4.cmd '"E:\Program Files\Beyond Compare\BComp.exe" "$LOCAL" "$REMOTE"'

之后只需要在gitbash中输入git difftool,就能自动打开beyond compare显示差异的文件

git difftool

但假如你文件夹里代码很多的话,beyond compare不会一起给你打开,而是一个一个打开,关掉一个,他再给你弹出来一个窗口,非常麻烦

git difftool --dir-diff

只需输入上述指令,就会比较整个文件夹的差异,哪些文件做过更改就会标红显示出来

 这时再想看哪个文件的差异,直接双击就会新建一个标签页显示

文章来源

评论可见,请评论后查看内容,谢谢!!!
 您阅读本篇文章共花了: