Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure SourceGear DiffMerge as mergetool and difftool for github windows?

I know we should use the commands "git mergetool" to resolve the conflicts and "git difftool" to compare the changes. But how do we set up SourceGear DiffMerge as github mergetool and difftool in github windows?

like image 290
vineel Avatar asked Feb 16 '17 19:02

vineel


1 Answers

I found two ways to configure "SourceGear DiffMerge" as difftool and mergetool in Github Windows.

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

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

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

[OR]

Add the following lines to your .gitconfig. This file should be in your home directory in C:\Users\UserName:

[diff]
    tool = diffmerge
[difftool]
    prompt = false
[difftool "diffmerge"]
    cmd = C:/Program\\ Files/SourceGear/Common/DiffMerge/sgdm.exe \"$LOCAL\" \"$REMOTE\"

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

Re-open the command prompt and try

example: git difftool */test.java
like image 62
vineel Avatar answered Nov 15 '22 17:11

vineel