May 4, 2010

External merge-diff - Git on windows

To configure and use Git in a Linux environment is quite easy, but if you are working in a Windows system, things get a little bit complicated.

I use MsysGit which is a great port to win32, and as a merge/diff tool I use WinMerge (I can't stand KDiff); to work with WinMerge as 'difftool' and 'mergetool' you could do this:

- First, create a wrapper script for our 'difftool', save this file as '' in your $HOME folder:

# Change "E:/bin/WinMerge/WinMergeU.exe" with your winmerge path
"E:/bin/WinMerge/WinMergeU.exe" -e -ub "$1" "$2" | cat

- Now, edit your $HOME/.gitconfig file, you can take as example my current configuration:
autocrlf = false 

lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

name = Timoteo Ponce
email =

tool = winmerge

[mergetool "winmerge"]
cmd = "E:/bin/WinMerge/WinMergeU.exe" "$MERGED"
keepBackup = false

tool = winmerge

[difftool "winmerge"]
cmd = $HOME/ "$LOCAL" "$REMOTE"