0

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]
Technoh
  • 1,606
  • 15
  • 34
  • Do you have sdiff installed? And, what is the exact output of `git mergetool`? Do u get something like `merge tool candidates` – Suganthi Aug 20 '13 at 15:33
  • @sugartea Question edited to answer your question. – Technoh Aug 20 '13 at 15:46
  • So git is using sdiff as the mergetool. You see the split screen of both versions. Are you not able to edit it there? – Suganthi Aug 20 '13 at 15:49
  • Exactly, I don't even get a chance to input any command for sdiff, I see the split screen but the screen scrolls down and I get the `[..] seems unchanged, was the merge successful? [y/n]` right away. – Technoh Aug 20 '13 at 15:52
  • I see. I have not used sdiff. I prefer vimdiff or any other 3 way merge tools. – Suganthi Aug 20 '13 at 15:56

1 Answers1

0

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?

Community
  • 1
  • 1
Suganthi
  • 417
  • 3
  • 14
  • I prefer 3-way merge tools myself but I can't seem to find one that isn't vimdiff or emerge and that I can run from the command line without a GUI. – Technoh Aug 20 '13 at 16:02
  • 1
    Why not vimdiff? Just curious – Suganthi Aug 20 '13 at 16:03
  • 1
    Steep learning curve, I wanted something quick to get started right away. – Technoh Aug 20 '13 at 16:08
  • You want something on the command line and simpler than vimdiff?? :-O – Suganthi Aug 20 '13 at 16:10
  • Simpler than vim, yes. I don't know vim or emacs and I thought maybe I could use some other tool so I wouldn't have to get to know either. – Technoh Aug 20 '13 at 16:13
  • Ok. Fair enough. You can start with some editor. I started with Jetbrains IDE. It has an awesome GUI based 3-way-merge tool. – Suganthi Aug 20 '13 at 16:14
  • Yes, that's what I'll do today, I'll copy the whole code base to my Windows machine, Git from there and push the changes back to my dev server. It's just so complicated because of my setup I thought it wouldn't hurt to ask for something that would make this much simpler. – Technoh Aug 20 '13 at 16:17
  • Ah. Thats a long process. You can install GUI based merge tools in Unix based systems as well.. – Suganthi Aug 20 '13 at 16:22
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/35854/discussion-between-technoh-and-sugartea) – Technoh Aug 20 '13 at 16:26