Add new merge conflicts menu and move the previous external merge tool there#3477
Open
recht wants to merge 1 commit into
Open
Add new merge conflicts menu and move the previous external merge tool there#3477recht wants to merge 1 commit into
recht wants to merge 1 commit into
Conversation
…l there Also add options for `git checkout --theirs` and `git checkout --ours` Fixes jesseduffield#2026
stefanhaller
reviewed
Apr 7, 2024
stefanhaller
left a comment
Collaborator
There was a problem hiding this comment.
This is a good start, but it needs some more work.
- Most importantly, it should support range selection. It should be possible to press shift-down-arrow to select multiple files, and then checkout theirs or ours for all of them. This raises the question of what happens if you select both a folder, and some of the files inside it; it seems that you should be able to call
normalisedSelectedNodeswhich was introduced for a similar situation. - I find the terms
theirsandoursproblematic; they are intuitive for a merge conflict, but they appear swapped for a conflict in a rebase. I know that we usually want to stay close to the terms that git CLI uses, but in this case even git CLI admits that the terms can be confusing (there's a long section in the documentation about it). VS Code's conflict browser usesHEAD (Current Change)for ours andIncoming Changefor theirs, which I find a little better. At the very least we should have good tooltips that explain this well. - It would be really good to have some integration tests for this. (You ticked the "Tests have been added/updated" in the PR description, that was cheating. 😄)
| { | ||
| Label: self.c.Tr.CheckoutOurs, | ||
| OnPress: func() error { | ||
| return self.c.Git().WorkingTree.CheckoutOurs(self.context().GetSelected().Name()) |
Collaborator
There was a problem hiding this comment.
This only works for top-level files. You want GetPath() instead of Name() so that it also works for files in folders.
Collaborator
There was a problem hiding this comment.
And you should call self.c.Helpers().MergeAndRebase.CheckMergeOrRebase(err) after this; this will cause any files that no longer have conflicts to be staged, and if no conflicting files are left, it will prompt to continue the rebase.
Author
I'll look into that - and I didn't quite cheat, I just didn't see that my |
7 tasks
stefanhaller
added a commit
that referenced
this pull request
Oct 9, 2025
Implements #2026. I also tried to address issues mentioned in the #3477 PR. Previously, pressing `M` opened an external merge tool. Now it opens a merge options menu that allows selecting all conflicts in chosen files as **ours** (HEAD), **theirs** (incoming), or **union** (both), while still providing access to the external merge tool. This uses [git-merge-file](https://git-scm.com/docs/git-merge-file) for a 3-way merge with the `--ours`, `--theirs`, and `--union` flags. This approach avoids the issue mentioned in #1608 (reply in thread), and correctly applies the chosen conflict resolutions while preserving changes from other branches. The command is executed with `--object-id`, which requires object IDs obtained via `rev-parse`, instead of relying on the standard version that works with full saved files.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also add options for
git checkout --theirsandgit checkout --oursFixes #2026
go generate ./...)docs/Config.md) have been updated if necessary