Ovler

Ovler

tg_channel
twitter
telegram
github

Configuring WinMerge as the comparison tool for Git on Windows.

Configuring WinMerge as the Git Diff Tool on Windows

Why use WinMerge#

  1. It's free and open source (unlike Beyond Compare, which costs $12 per year)
  2. It's really useful (much better than the built-in git diff)
  3. It looks good too (?)

How to install WinMerge in git#

  1. Go to the official repository and download the WinMerge version that corresponds to your operating system. Install it with the default settings.
  2. Find the git configuration file .gitconfig. For Windows users, it's usually located in the user folder C:\Users\%username%. If you're using a different system, then sorry, this guide is for WinMerge (just kidding).
  3. Add the following configuration to the file:
[diff]
tool = winmerge
[difftool "winmerge"]
cmd = "'C:/Program Files (x86)/WinMerge/WinMergeU.exe'" -e "$LOCAL" "$REMOTE"
[difftool]
prompt = false
[merge]
tool = winmerge
[mergetool "winmerge"]
cmd = "/c/Program\\ Files\\ \\(x86\\)/WinMerge/WinMergeU.exe" -u -e -wl -wr $LOCAL $BASE $REMOTE -o $MERGED
[mergetool]
keepBackup = true
trustExitCode =true

Usage#

To compare differences:

git difftool <file_name>

To merge conflicts:

git mergetool

Simplify Commands#

If you find the commands too long and inefficient during actual usage, you can set up aliases for them.

git config --global alias.dft difftool
git config --global alias.mgt mergetool

For example, I've configured difftool and mergetool as dft and mgt aliases, respectively. You can use them directly like this:

git dft
git mgt

References#

Use WinMerge inside of Git to file diff
Configuring Beyond Compare as the Git Diff Tool on Windows
Using WinMerge as the Git Diff/Merge Tool on Windows 64-bit

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.