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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With