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?
Asked
Active
Viewed 5,559 times
11
-
http://stackoverflow.com/questions/426026/git-on-windows-how-do-you-set-up-a-mergetool . This is already answered here. – jAvA Feb 16 '17 at 21:41
-
@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! – vineel Feb 17 '17 at 10:55
1 Answers
22
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

vineel
- 3,483
- 2
- 29
- 33
-
I keep setting up new profiles that I've made this a shell script! – Sridhar Sarnobat Oct 09 '21 at 09:36