How can I configure sdiff as a merge tool for git?

1.1k views Asked by At

I am still looking for a good command line (no GUI) git merge tool as I do not know vim or emacs. I found the following on how to use sdiff for merging, which seems pretty simple.

I cannot seem to make sdiff work properly. I currently have the following in my .gitconfig file, but git mergetool complains that git config option merge.tool set to unknown tool: sdiff.

[merge]
        conflictstyle = diff3
        tool = sdiff
[mergetool "sdiff"]
        path = /usr/bin/sdiff

With cmd = sdiff $LOCAL $REMOTE in .gitconfig when I try git mergetool I do not get the chance to edit anything but get the message Was the merge successful? [y/n] right away.

What is the correct configuration to make sdiff work as a merge tool for git? Alternatively, if you know of a better command-line tool that does not have a steep learning curve, I would like to know.

Edit: here is what I get when I run git mergetool:

Merging:
[list of files]

Normal merge conflict for 'xx/yy/zz.php':
  {local}: modified file
  {remote}: modified file
Hit return to start merge resolution tool (sdiff):

[Split screen of both versions]

xx/yy/zz.php seems unchanged.
Was the merge successful? [y/n]
1

There are 1 answers

9
Suganthi On

sdiff is a 2 way merge tool. I prefer 3 way merge tools.

Read more about why 3 way merge tools is less error prone in this link: Why is a 3-way merge advantageous over a 2-way merge?

And, some of the best 3 way merge tools are listed here: What's the best three-way merge tool?