Hacker News new | ask | show | jobs
by IshKebab 2596 days ago
Sure but I've never found a GUI or editor that lets me resolve conflicts in the way I want.

For example say I change one line of code in a big function. I rebase and that function has moved. Conflict!

I want a tool that says "here's what you changed, and here's the current state of the source". None of them do that though - they all just show the conflicts that git writes to disk - the code after you changed it, and the current code.

You basically get two copies of the function, one with your change and one without and you have to manually (visually) diff them to work out what you changed (or go back and look at your commit) and then reapply that change to the moved function.

It's really awkward and could definitely be better.

5 comments

Even without plugin in a three-ways tool, Git's conflict can provide more information.

    [merge]
        # display 3 parts for each conflict,
        # including the common ancestor
        conflictstyle = diff3
There's also the option to use a semantic merge tool. AFAIK, there are only paying tools for this, and only a few languages are supported.
What you, and also I, want is a syntax-aware merge tool, i.e. one that can tell you the meaning of the change. If a function got moved to another place, or if 2 fields swapped places, I don't want it to have the same importance as na actual change in behavior. No importance, even.

Git's only sense of syntax is recognizing lines, and it's just not enough in too many cases.

Sadly in my (short) research everything I have found is either closed source or I can't afford to pay for it. It's even more saddening that git already has built-in bits for syntax related diffs.

Have you tried a three-way-merge tool (e.g. vimdiff, meld, kdiff3, surely some emacs way of doing it)?
Three-way diff is (probably) what you want. E.g. Intellij Idea uses it by default, and likely plenty of other IDEs and editors do too.

You see original code, you changes, and the other side's changes—and where exactly they conflict.

I spent some time with `git mergetool` to help resolve conflicts. It's hideous but it's better than staring at inline conflict markers