Giter Club home page Giter Club logo

Comments (12)

AndrewRadev avatar AndrewRadev commented on May 27, 2024 1

I've created a branch, merge-conflicts, where I've started working on this. So far, there's a new command, :LinediffMerge, which tries to detect a merge area around the cursor and opens up the linediff buffers for the two areas.

One thing I hadn't considered, though, is what to do from there on. Sure, you have the two areas, but if you change them both, they're just going to change in their respective positions. How do you actually merge them?

The way I'm thinking right now is:

  • You run :LinediffMerge on a merge conflict
  • You make changes to one or both linediff buffers
  • You run the command :LinediffPick on one of the buffers
  • That buffer replaces the entire merge area

The :LinediffPick command is not yet implemented, but what do you think of the idea, @m42e, @ipsquiggle? Would that be a reasonable workflow for you both?

from linediff.vim.

AndrewRadev avatar AndrewRadev commented on May 27, 2024 1

I've merged the branch with master (ironically enough, I had merge conflicts :)). The merge/pick commands should be available in master now as well, so I'll go ahead and close this issue.

from linediff.vim.

AndrewRadev avatar AndrewRadev commented on May 27, 2024

That seems like a pretty good idea. I'll think about adding a separate command that triggers this.

from linediff.vim.

ipsquiggle avatar ipsquiggle commented on May 27, 2024

This would be incredible! I hadn't even considered using linediff for these kinds of merges but it's current behaviour would already be super useful here. Having a variation that smartly parses this format and then replaces the block with the merged result would be beautiful.

from linediff.vim.

m42e avatar m42e commented on May 27, 2024

Well I had a problem, merging two tex documents and I could not find the difference (It was an uppercase instead of a lowercase letter) and I found this plugin.

from linediff.vim.

ipsquiggle avatar ipsquiggle commented on May 27, 2024

Yes, it's the kind of thing which, now that I think about it, would be best done in a 3 way merge. Given that that would be a whole new ball of wax, I think what you propose is sane as a workflow: see the two diffs, merge the changes into the one that is "closer to what I want", and then pick that one.

from linediff.vim.

xaizek avatar xaizek commented on May 27, 2024

Yes, it's the kind of thing which, now that I think about it, would be best done in a 3 way merge.

It depends, fugitive has three-way conflict resolution (just run :Gdiff), but it confuses me more than it helps. At the moment I prefer to select conflicting chunks via LineDiff, make them look the same and remove one of them later. I guess it's because you can be "in context" of one of branches that is being merged and analyzing differences between that and something else is easier than thinking of three versions two of which are less familiar than the third one.

from linediff.vim.

AndrewRadev avatar AndrewRadev commented on May 27, 2024

I've implemented the :LinediffPick command that I mentioned above. It seems to work, but I haven't tested it too deeply. Could you try it out and let me know how it goes?

from linediff.vim.

xaizek avatar xaizek commented on May 27, 2024

Thanks, @AndrewRadev! Works fine for me. One thing to think about is displaying labels from merge markers, I think it would be helpful to see them (not that it provides much context, but helps to ensure you're making right choice without switching to original tab).

from linediff.vim.

AndrewRadev avatar AndrewRadev commented on May 27, 2024

I'll see what I can do.

from linediff.vim.

AndrewRadev avatar AndrewRadev commented on May 27, 2024

Sorry it took so long to get around it, but I guess it just fell to the side and I promptly forgot about it. I've added labels to :LinediffMerge that should prove useful. I was planning on directly merging the merge-conflicts branch, but with this change, I figure I'll leave it around a bit longer and then merge. In my work, I'm currently dealing with a lot of merges, so I hope I won't forget about it this time.

from linediff.vim.

blueyed avatar blueyed commented on May 27, 2024

Sounds interesting.
I've only recently discovered this plugin, and it turned out to be useful by itself already.

JFI/btw: consider setting merge.conflictstyle = diff3 in Git's config, which gives you an extra hunk of context in the middle.

from linediff.vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.