Monday, September 9, 2013

DiffMerge : A Merging tool for Git

When using the distributed Version Control i.e. Git, your files might conflict since multiple users might have been working on same file.

Hence, you can use any text editor which is boring, tiresome and hard to identify where the issue is. The best option is to use a merging tool such as Diff Merge. (Click on the link to go to the downloads page)

I faced one configuration issue when I was trying to use it for the first time.
The error was "Unexpected Parameter". The configuration from the software manual didnot work for me.

The solution is to edit the .gitconfig file manually to look like the following.

The following commands in a Command Prompt window will update your .gitconfig to configure GIT use DiffMerge:

C:\> git config --global diff.tool diffmerge
C:\> git config --global difftool.diffmerge.cmd "C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe \"$LOCAL\" \"$REMOTE\""

C:\> git config --global merge.tool diffmerge
C:\> git config --global mergetool.diffmerge.trustExitCode true
C:\> git config --global mergetool.diffmerge.cmd "C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe  --merge --result=$MERGED $LOCAL $BASE $REMOTE" trustExitCode = true keepBackup = false

The code snippet that is Bold is the major change made.