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

1

12

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?

Seepage answered 16/2, 2017 at 19:50 Comment(2)
#426526 . This is already answered here.Bombast
@Java: Thanks for sharing the link. But that didn't help, I tried those commands to configure "SourceGear DiffMerge" but it didn't work. Found the solution and mentioned below. Thanks!Seepage
S
23

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
Seepage answered 17/2, 2017 at 10:51 Comment(1)
I keep setting up new profiles that I've made this a shell script!Hinkley

© 2022 - 2024 — McMap. All rights reserved.