sublimehq / sublime_merge

Issue tracker for Sublime Merge
https://www.sublimemerge.com
274 stars 14 forks source link

Making the process of doing three-way merge more convenient #1869

Open ajitid opened 8 months ago

ajitid commented 8 months ago

Problem description

Sometimes while in the middle of resolving merge conflicts for a file, I want to know the history/commit that led to a conflict in a hunk. But because Sublime Merge replaces the repo tab with three-way merge view, the only choice I'm left with is to:

  1. discard the progress I made to resolve the conflicts for the file so that I could go back to the default view,
  2. use the default view's query feature to compare the changes b/w branches,
  3. come back to three merge view, re-resolve the conflicts which I resolved before discarding the file and then resolve the actual conflict for which I went back for.

Preferred solution

I'd prefer if Sublime Merge gives an option to open multiple tabs for a repo, even if those other tabs are read-only. This would make it very easy to perform simultaneous queries on different branches so we could easily compare them. This is the preferred solution.

Alternatively, I'd want to have an option to "save my progress" in a three-way merge view. Upon clicking this, I can come back to the default view, perform my queries, and click on Resolve again to resume resolving conflicts in that file. I want that option to live somewhere in here:

image

The Cancel button should still retain its current operation — discard any merge progress that has been made. Because the way Sublime Merge works is that you either resolve the whole file completely or don't, I expect some new code would needed to be added to retain Cancel's functionality.

(Sidenote: The really odd option that lives here is "Save without staging". It removes git markers from the file but still I get an option to Resolve in SMerge and I still see all the conflicts as unresolved in it. I do not understand why I would want to use this.)

Alternatives

Right now I open the branches in GitHub to compare the file.

MrPotatobird commented 7 months ago

This was my biggest issue with sublime merge. I have a workaround, but it's still not ideal IMO. I would definitely like to open multiple tabs with the same repo (#1832)

You can set up the resolve interface as a standalone merge tool for git (https://www.sublimemerge.com/docs/command_line). After doing that, I added a shortcut to use it in Sublime Merge by adding Advanced Merge Conflict.sublime-menu to Packages/User with:

[
    {   "caption": "-"},
    {
        "caption": "Resolve in New Window",
        "command": "git",
        "args": {"argv": ["mergetool", "$path"]}
    },
]

image

Ideally what I'd want to do is:

I like "Save without Staging," it's basically the same as staging but if I mess something up I can easily try again for that file. If there's no problem I can just stage like normal. If I save and stage, there's no way to get back to the conflict resolution window without restarting the whole merge. So it's too bad that I can't do it in the standalone window, and I can't add it either because the save_without_staging command doesn't work. It also opens kind of slowly and inconveniently, which is not a huge deal.

If they do allow saving mid-merge, it would also be nice to be able to open_in_editor from the three-way widget; that command doesn't work either. But that's kind of a separate issue.

srbs commented 7 months ago

If I save and stage, there's no way to get back to the conflict resolution window without restarting the whole merge.

@MrPotatobird, I have a workaround for that specific issue: https://github.com/sublimehq/sublime_merge/issues/362#issuecomment-459261965