use Winmerge inside of Git to file diff

前端 未结 8 1107
清酒与你
清酒与你 2020-11-27 09:34

Is there a way to use Winmerge inside of git to do Diffs?

8条回答
  •  春和景丽
    2020-11-27 10:05

    Since the thread is getting confusing and bifurcated, here are consolidated instructions for the Directory Listing "--dir-diff" WinMerge method for msysgit Git Windows.

    Step 1 - Create a file named winmerge.sh at a location accessible to your path (such as /home/bin/winmerge.sh) with following contents.

    #!/bin/sh
    echo Launching WinMergeU.exe: $1 $2
    "$PROGRAMFILES/WinMerge/WinMergeU.exe" -r -ub -dl "Remote" -dr "Local" "$1" "$2"
    

    Step 2 - Type the following commands in Git Bash to instruct git to use winmerge.sh as difftool (these options get stored in /home/.gitconfig):

    git config --replace --global diff.tool winmerge
    git config --replace --global difftool.winmerge.cmd "winmerge.sh \"$LOCAL\" \"$REMOTE\""
    git config --replace --global difftool.prompt false
    

    Step 3 - Now you can test by typing the following command in Git Bash to start your WinMerge diff:

    git difftool --dir-diff
    

    Step 4 - For quicker access, create an alias for this command by adding this line to .bashrc in your home folder (or create .bashrc file with this line if file does not already exist):

    alias diffdir='git difftool --dir-diff'
    

    Step 5 - Now you can quickly see a diff in WinMerge just by typing the following command into Git Bash

    diffdir
    

提交回复
热议问题