ubuntu下git使用Beyond Compare来做diff和merge方法
? ? 之前我寫過一篇文章, git使用vimdiff來做diff比較的 ,原文鏈接:
? ??https://blog.csdn.net/ballack_linux/article/details/56670311
? ? 有興趣的可以看一下。
? ? 有時(shí)候文件改動(dòng)太多的時(shí)候, 使用vimdiff就不太方便了, 這里建議使用Beyond Compare來做比較,相信熟悉windows開發(fā)的應(yīng)該對(duì)這個(gè)工具都不陌生,非常好用的一款工具,話不多說,先到官網(wǎng)下載一個(gè)linux版本的工具:
? ??http://www.scootersoftware.com/download.php
? ? 我的是ubuntu 64bit的, 那么這里就下載一個(gè)deb版本的 ,下載下來后bcompare-4.2.8.23479_amd64.deb。?
? ? 雙擊安裝即可。
? ? 安裝完成后就會(huì)在/usr/bin/下面找到bcompare 這個(gè)可執(zhí)行文件, 在終端上輸入bcompare,就可以啟動(dòng)Beyond Compare了。
? ? 接著配置git的global參數(shù) :
git config --global diff.tool bc3 git config --global difftool.prompt false git config --global difftool.bc3.cmd '/usr/bin/bcompare "$LOCAL" "$REMOTE"' git config --global merge.tool bc3 git config --global mergetool.prompt false git config --global mergetool.bc3.cmd '/usr/bin/bcompare "$LOCAL" "$REMOTE" "-savetarget=$MERGED"' git config --global mergetool.bc3.trustexitcode true git config --global alias.d difftool git config --global alias.m mergetool? ? 命令執(zhí)行結(jié)束后,在用戶目錄下, cat? .gitconfig?, 就可以看到以下內(nèi)容:
[diff]tool = bc3 [difftool]prompt = false [difftool "bc3"]cmd = /usr/bin/bcompare \"$LOCAL\" \"$REMOTE\" [merge]tool = bc3 [mergetool]prompt = false [mergetool "bc3"]cmd = /usr/bin/bcompare \"$LOCAL\" \"$REMOTE\" \"-savetarget=$MERGED\"trustexitcode = true [alias]d = difftoolm = mergetool? ? 正常使用的時(shí)候, 使用 ?git ? d 或者 git ?m 即可實(shí)現(xiàn)diff和merge的功能, 具體效果請(qǐng)自行體驗(yàn), 哈哈 !!???
? ? ? ?
總結(jié)
以上是生活随笔為你收集整理的ubuntu下git使用Beyond Compare来做diff和merge方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: QQ个性装扮气泡免费使用
- 下一篇: 互联网大脑的云反射弧路径选择问题,兼谈E