Hacker News new | ask | show | jobs
by codedokode 1552 days ago
Meld might be useful for comparison, but in my opinion it is inconvenient as a git merge tool. For git merge I need four panels: original file, version A, version B, merged result. Meld has only three panels.

Currently I am using KDiff3. It is a little buggy and doesn't have a nice UI but it is the best open source merging tool that I am aware of. It allows choosing lines from original file, from A, B and manual editing.

I noticed that certain popular and highly praised commercial IDE also provides only 3-panel interface for merging. This makes resolving conflicts more difficult and prone to errors.

6 comments

My .gitconfig for using meld at the git merge tool - which gives you that:

  [alias]
    mt = mergetool

  [merge]
    tool = mymeld
    conflictstyle = diff3
  
  [mergetool "mymeld"]
    # Gives you meld, with three comparison tabs. Assuming you're merging others changes into
    # your branch, this shows you:
    # - 1st tab: yours|merged result|theirs (do the merge here into the middle pane)
    # - 2nd tab: base vs your changes (look at just your changes)
    # - 3rd tab: base vs their changes (look at just their changes)
    cmd = meld $LOCAL $BASE $REMOTE --output $MERGED --diff $BASE $LOCAL --diff $BASE $REMOTE --auto-merge
> original file, version A, version B, merged result

Isn't one of version A or B the original file? What am I missing?

http://psung.blogspot.com/2011/02/reducing-merge-headaches-g...

This is a good discussion on the topic including the diff3 option git has.

the "original" file is the common ancestor of version A and version B
In a merge conflict versions A & B would tend to be different changes made to the original, usually made by different people.
I really wish kdiff3 would get a modern update.
kdiff3 does have a modern version: https://invent.kde.org/sdk/kdiff3/.

Unfortunately versions starting at 1.9.0 are drastically buggier than 1.8.5: Ctrl+C being incorrectly enabled and disabled (https://bugs.kde.org/show_bug.cgi?id=444636), merge errors (https://bugs.kde.org/show_bug.cgi?id=437570, fixed), drastic slowdown when loading CRLF files (https://bugs.kde.org/show_bug.cgi?id=450411, fixed), recurring assertion errors (didn't personally encounter, but https://bugs.kde.org/show_bug.cgi?id=426301, https://bugs.kde.org/show_bug.cgi?id=442618), large chunks of Git history producing unusable binaries that corrupt memory or print assertion errors when loading files, etc. I stopped following KDiff3 development and decided to pin 1.8.5 on my system, which actually works.

Another fork of KDiff3 is https://github.com/michaelxzhang/kdiff3. I haven't tested it, but I hope the alternative diff coloration makes it easier to see single-word/space insertions and deletions within a line (which is something I often fail to notice in mainline KDiff3).

I agree 100% on the utility of a 4 panel diff, but I'd be careful using kdiff3... I also used it for quite a while but found that it would "auto resolve" some merge conflicts which git would flag, and I found it would sometimes auto resolve them wrong (maybe about 10-20% of the time?), and I couldn't figure out how to turn this feature off... I'm using tortoise git merge now (which also does do some auto resolve but only simpler resolutions)
According to `kdiff3 --help`, there's a flag --qall "Do not solve conflicts automatically.".

I've not noticed the problem you describe, so can't confirm whether it is solved by that flag - a while ago I mostly switched to Sublime Merge from kdiff3.

i've used kdiff3 for some hairy merges with good results.

back in the days when i was responsible for regular merges for a pretty big project (weekly or so, 10-30 devs on both sides, n*1e7 LoC), i took the time to learn ediff and did my merges in lucid/xemacs.

i had colleagues at the time who had nice things to say about beyondcompare.

more recently i have seen this meld thing and it has piqued my curiosity.

favorite tool for quick no-frills out-of-practice-with-real-tools visual diff is fldiff built on fltk.

Another vote from here. I've tried a good number of merge tools but always go back to KDiff3. It has the best automatic merge conflict resolver I've seen, and really just enables me to fix things and continue.

I often have colleagues who are inexplicably afraid of merge conflicts and try to negotiate who's working on which parts of the app. I think a proper merge tool could help them to overcome this.