Git使用技巧

Git Windows下配置Merge/Diff工具DiffMerge

參考:Git Windows下配置Merge工具DiffMerge

  1. 下載DiffMerge
    DiffMerge下載地址

    Paste_Image.png

  2. 創(chuàng)建啟動DiffMerge腳本

1)在Git的安裝路徑的\cmd路徑下創(chuàng)建以下兩個腳本,注意安裝路徑,見圖

git-difftool-diffmerge-wrapper.sh

# place this file in the Windows Git installation directory /cmd folder
# be sure to add the ../cmd folder to the Path environment variable

# diff is called by git with 7 parameters:
# path old-file old-hex old-mode new-file new-hex new-mode

"C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe" "$1" "$2" | cat

git-mergetool-diffmerge-wrapper.sh

# place this file in the Windows Git installation directory /cmd folder
# be sure to add the ../cmd folder to the Path environment variable

# passing the following parameters to mergetool:
# local base remote merge_result

"C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe" "$1" "$2" "$3" --result="$4" --title1="Mine" --title2="Merge" --title3="Theirs"
Paste_Image.png
Paste_Image.png

2)將\cmd設置環(huán)境變量,方便找


Paste_Image.png

3)黑掉Git配置文件
找到.gitconfig文件(路徑在Windows“用戶”路徑下),
相關內(nèi)容用下面的替換

[merge]
    tool = diffmerge
[diff]
    tool = diffmerge
[mergetool]
    keepBackup = false
[mergetool "diffmerge"]
    cmd = git-mergetool-diffmerge-wrapper.sh "$LOCAL" "$BASE" "$REMOTE" "$MERGED"
[difftool "diffmerge"]
    cmd = git-difftool-diffmerge-wrapper.sh "$LOCAL" "$REMOTE"

4)解決中文亂碼問題

Paste_Image.png

Paste_Image.png
最后編輯于
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

  • git 使用技巧總結說明: 本地repo已經(jīng)有啦,對應的遠程repo 為tiger, 本地分支為master。 問...
    _Justin閱讀 670評論 0 0
  • 技巧和竅門 在結束本章之前,我還想和大家分享一些 Git 使用的技巧和竅門。很多使用 Git 的開發(fā)者可能根本就沒...
    很少更新了閱讀 221評論 0 0
  • npm 為了讓你更了解 npm,我們要做兩件事(可不做)運行 npm config set loglevel ht...
    coolheadedY閱讀 2,295評論 0 0
  • 小時候,作文課寫的最多的就是夢想。 那時候,我們的夢想像天上的星星一樣,一閃一閃。沒有人會嘲笑我們,只是笑著鼓勵好...
    共央閱讀 514評論 2 0
  • 10.9來到簡書,為了圖一個好記,干脆以10.10為筆耕心路起點吧。 丹江駙馬爺: 24歲單身男青年,來到丹...
    丹江駙馬爺閱讀 527評論 0 1

友情鏈接更多精彩內(nèi)容