Vscode: Support Git conflict resolution tool similar to IntelliJ, WebStorm

Created on 31 Oct 2017  ·  91Comments  ·  Source: microsoft/vscode

IntelliJ, and all other IntelliJ-based IDE such as WebStorm, support a git merge's conflict resolution tool that it shows the conflict in three columns:

  • the first column for Local Changes
  • the third column for Changes from Server
  • the second column for Conflict Resolution Result

Please see my attached file.
merge-conflict-resolution

I find that it's super easy for us to resolve conflict, because I can compare the Local Changes and the Server Changes on the same windows, and I can see the Resolution Result immediately.

Can we please support that?

feature-request merge-conflict

Most helpful comment

This will be a super cool feature, I use VSCode for my day job but often resort to WebStorm when I need to resolve a merge conflict due to its interactivity and ease to use.

All 91 comments

This will be a super cool feature, I use VSCode for my day job but often resort to WebStorm when I need to resolve a merge conflict due to its interactivity and ease to use.

Any news on this? this feature would be amazing. On one hand, there is a diff tool (i.e. comparing two files) in VS code, but you cannot edit / chose what to keep; on the other hand, there is a merge conflict tool that allows to chose what to keep (current change / their change). Now, the best would be to have both tools into one tool, such as the tool suggested by @uyhung.

I also wanted to add, for any contributor who comes by: VS Code is an amazing piece of software, keep it up :) !

That will be an amazing feature... any news on it? does anyone recommend some extension that does something similar?

I'm using that on PyCharm. Such amazing feature, it helps a lot with avoiding bugs on bigger merges. All linters are available during process, so errors/style violations/unused variables are easy to spot.

Please hurry up with this feature if you're planning to implement it :)

Thumb up 👍 for this one. That's the only thing holding my back to totally switch to VSCode. Would be super helpful and handy.

The day you implement this feature I will stop using webstorm.

Not only to resolve conflicts, this design should be available to see the history file too.

git config merge.conflictStyle diff3 and you have this today but with VSCode's in-editor layout - which is vastly better than popping up a dialogue and a new window to view the file you already had open IMO!

Any news? Is it scheduled maybe, or planned to be scheduled?

Yes really needed

this is much needed feature, im using inteliij idea just to resolve conflicts.

+1, this would be awesome!

+1 here! Trying to make the switch, but IMO this is one of the major features missing to switch from WebStorm to VSCode

Can we please stop with the +1 comments? It brings nothing to the conversation.
Just watch this thread and wait...

@Zielak +1 let's stop adding more comments

Anyone know if there is any plugin that can make this possible ?

@rajjejosefsson As I said above, you can set: (git config merge.conflictStyle diff3)

[merge]
  conflictStyle = diff3

to see them/common/us. It won't change the VSCode formatting/theme, but you will get those three parts to your diff instead of just them/us as is the (git) default.

Unless there's something else (other than opening multiple dialogues just to get back to view a diff in the file you already had open) that JetBrains IDEs offer that I'm missing here?

The newly released Sublime Merge has a similar implementation.

This will be a super cool feature, I use VSCode for my day job but often resort to WebStorm when I need to resolve a merge conflict due to its interactivity and ease to use.

You can add these configuration in your .gitconfig file and type "git mergetool" on your terminal whenever conflict appears. It'll only open your merge gui interface from webstorm for each file.

[mergetool "webstorm"]
    cmd = webstorm merge $(cd $(dirname "$LOCAL") && pwd)/$(basename "$LOCAL") $(cd $(dirname "$REMOTE") && pwd)/$(basename "$REMOTE") $(cd $(dirname "$BASE") && pwd)/$(basename "$BASE") $(cd $(dirname "$MERGED") && pwd)/$(basename "$MERGED")
    trustExitCode = true
[merge]
    tool = webstorm

+1 here, is now the only reason I use webstorm!

+1

+1

True, VS Code is amazing except for the lack of this UI tool.

+1, This is exactly what I expect the merge tool to look like.
And #5770 should be implemented like this.

+1 it's the only feature that I'm really missing while using VSC in comparison to WebStorm.

I would very much like this implemented as well, the only big whole I see in VS code as a full IDE

Ok, since Webstorm seems to be the only real solution, I'm going to go download that now.
Really looking forward to VSCode supporting this feature!!

Also, could someone downvote this post for me? Thanks :P

Is this feature even in the works?

+1, totally would use this if implemented

I added a new setting and command to improve the merge conflict resolution a bit, here is what the experience will be after https://github.com/microsoft/vscode/pull/74231 is merged

Firstly a new setting merge-conflict.diffViewContext was added to show the context around the conflict

Before: there is no context around the diff
compare-withoutcontext

After: with "merge-conflict.diffViewContext": 3
compare-with-context

Secondly, a new command Compare All is introduced to display the full compare between current workspace and incoming changes, with which you can compare the old content, the incoming one, and the latest local content on disk

compare-all

More work in the editor area needs to be done to support the JetBrains style, for example, opening a three column editor group from the conflict. But I still want to hear your feedback on the current solution mentioned above.

This is cool. Can you pick line by line what change you want to merged into the new file or is it just one file or the other? Line by line or All would be awesome!!!

If you can accept each change from either file block by block and merge into the third that would probably cover most use cases. So for example if one file had 3 changes and the other file had 4 I could chose whatever I wanted. Like accept 2 changes from one file and 2 changes from the other. Can it do this? If so...that rocks!

@rebornix The additional context is nice, and I like the compare all, but for me there still a few things missing:

  1. Comparing each "side" with the common base -- while a 3-way merge view is probably best, this could at least help in the interim (I've been toying with adding something for this in GitLens)
  2. Being able to edit in the compare view and have the changes sync'd back to the document -- this is something that was talked about before better-merge was brought into the core. Here was a request about it (though the original request is gone :cry:) https://github.com/microsoft/vscode/issues/10547#issuecomment-300201327'

# 2 can probably be done today with a custom file system provider (though that feel like a lot of overkill)

@eamodio

Comparing each "side" with the common base -- while a 3-way merge view is probably best, this could at least help in the interim (I've been toying with adding something for this in GitLens)

This one requires adding a new three way diff view (a three way diff algorithm and a three column editor) but it's doable. For # 2, I think a custom file system provider is the right way to go as the file content on disk contains merge conflicts (like >>>>>>, <<<<<<), while picking content changes from the diff view, we don't want to mess up with the file on disk, so it' a virtual file system provider already.

Need this feature very much.

@rebornix I like the idea I think it can be even better than open a 3 column editor since the laptop screens are not soo big. I think can be easier to improve it a bit to look finally like the Gitkracken merge tool showing the context on the top editor and allowing editing the reluting file (that currently has >>>><<<< ...) on the bottom.
merge-tool@2x

Yeah, often when there is merge conflict I switch to PHPStorm, even if the other work on the project I do in VSCode. It's weird that two years passed and there is still no appropriate merger.

@rebornix I like the idea I think it can be even better than open a 3 column editor since the laptop screens are not soo big. I think can be easier to improve it a bit to look finally like the Gitkracken merge tool showing the context on the top editor and allowing editing the reluting file (that currently has >>>><<<< ...) on the bottom.

I disagree, the three column layout is part of what makes the Webstorm one so great. It keeps a very neat overview

Same here, I always switch over to IntelliJ for merge conflict resolution. The „Resolve simple conflicts“ magic wand tool saves so much time too!

I change back to Visual Studio 2017 to resolve conflicts...

On Tue, Jun 25, 2019 at 8:35 AM fabb notifications@github.com wrote:

Same here, I always switch over to IntelliJ for merge conflict resolution.
The „Resolve simple conflicts“ magic wand tool saves so much time too!


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/microsoft/vscode/issues/37350?email_source=notifications&email_token=AAEN6O3LOPBVEY7PMABVNRDP4I3KZA5CNFSM4EBV5J4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYQUWAQ#issuecomment-505498370,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEN6O4AO24V4GB24EWOJGDP4I3KZANCNFSM4EBV5J4A
.

vscode must change git conflict tool, because while resolving conflicts vscode adds <<<, ===, which causes language syntax error

@SupinePandora43 That's not VSCode, that's how git handles conflicts, it adds <<<, === to conflicting lines. WebStorm parses this blocks and creates great visual tool for merging.

@vedmant then... vscode needs some parser

@minkir014 Check attached image on original comment on top, this what everybody mean.

This is in vs code tips and tricks and that means it's built in vs code. So, why this issue is still opened?

@minkir014 I'll link the image from original comment here again, cause you clearly are thinking about something different: https://user-images.githubusercontent.com/1470309/32250860-c677e4ce-bec0-11e7-82b5-0196d981cc28.png

@minkir014 What's in VS code now is nothing near the feature IntelliJ has, just compare this: https://user-images.githubusercontent.com/1470309/32250860-c677e4ce-bec0-11e7-82b5-0196d981cc28.png and what you posted https://github.com/Microsoft/vscode-tips-and-tricks/blob/master/media/resolve_merge_conflicts.gif do you see much similarities?

@minkir014 because built in feature it's not the same as we are discussing in this thread.

Three way merge is the only feature blocking me from using VSCode as my only IDE.

Three way merge is the only feature blocking me from using VSCode as my only IDE.

I hear ya. This is a killer feature we need to have. I have to keep PHPStorm around just for this reason.

It took me awhile to realize that you have most of what you _need_ contained in updates from the above thread, it's just not displayed pretty, nor can it do arbitrary 3-way diffs (to be super-powered in the future by GitLens with arbitrary commit diffing and ancestor selection, no doubt).

The below config changes cover most real-world merge-conflict contextualization needs better than default VSCode/Git settings when you want to be able to understand the context of two different changes when they were made, while simultaneously reconciling their differences. So, for future searchers:

  1. Enable reveal of the common (differing) ancestor of two diffs by changing your git conflict style to diff3. Do this by either editing your ~/.gitconfig or using the cli: git config merge.conflictStyle diff3
  2. Set your VSCode setting for Diff View Position to "Below" or "Beside" "merge-conflict.diffViewPosition": "Below"

Congratulations, you now can see the context of your two diffs as static references, the common base they both branched from, and all while still making edits to all three contexts (ancestor, branch A, and branch B) using in-line diffing. It's now a poor-mans vimdiff.

(adding a static pane to display the common ancestor diff without highlights would be a low-hanging fruit easy addition without requiring major editor or diff algo updates, speaking of vimdiff)

And if these are not changes in GIT? (I'm using perforce, and I don't have a choice in that right now.)

Duplicate of #25887

That's a two column view. This is a three column view.

Duplicate of #25887

That's a two column view. This is a three column view.

I thought it would be worth linking the issues together, cause it's the same problem.
Two or three columns are part of the solution.
On a side note, my motivation for linking is to get attraction from both issues and add the missing behaviour as soon as possible - I would really want to use that feature ☺

But here are 427 votes against 310 (# 25887). Maybe you can merge count the votes together if you want to merge already. This feature will be top 10

Implementing an effective and user friendly IntelliJ style 3 pane merge (sometimes refered to as three way merge, but it is two files merged into a result pane) would place the VS Code editor product on the top of the world. I am certain of this - and several of these threads and many comments tell the tale of people "holding on" to their Intellij products just because of the lack of this feature. I don't see how a feature request could be better motivated or a clearer priority for the product owners / developers. Any news on your (devs, managers on vs code) thoughts on this?

The fact that some people allude to how close features allready implemented brings VS Code to the desired result, only tells me that implementing this all the way shouldn't really be that demanding, if most of the work is already done.

This is exactly why I still use Meld as my mergetool

This is exactly why I still use Meld as my mergetool

Sublime merge is far better than meld

This is exactly why I still use Meld as my mergetool

Sublime merge is far better than meld

I agree, though I don't think this is the place to discuss what merge tool is the best one out there.

Is it at least possible to show a common BASE for both Current and Incomming changes?

@ackvf yes, you can with three-way diff

so, What's new?

Waitng too, anybody plz notice me when its available

waiting the same...have that tool will be amazing

maybe i should get IntelliJ too :)

+1 here, is now the only reason I use webstorm!
+1
waiting the same...have that tool will be amazing
maybe i should get IntelliJ too :)

Please stop spamming all subscribers of this ticket with non-related messages.

Check this out https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph#review-details . I think this extension almost has alike features as in Webstorm IDE.

This is the main reason I don't use vscode as my main editor. Would be great to see this added as the built-in git integration and merging is so much more helpful in WebStorm. Would be great to see this added.

I need this in my life.

No news about this feature ? or even a plugin is fine :D ??

vscode is great but indeed still using intellij merge tool just for that .. )

All the news we have is the 2020 Roadmap which mentions "full merge support (3-way)": https://github.com/microsoft/vscode/wiki/Roadmap#scm

Oh man! such a big miss from VSCode. I wonder how developers survive without this feature. I am going to resort to Webstorm for this

Checked the Git Graph extension for Visual Studio Code but still isn't the feature. Im using vscode for all but merge versions selective with pycharm.

_Still_ using IntelliJ for merging. Also the commit panel, where we can choose which commits from the same file to keep. etc. 😐

Man I created this request 3 years ago :)

Though VSCode is great, I still have to use Webstorm for Git related tasks :(

I'm waiting for it

why still no support this? is there any vscode plugin play the same role in the market?

@sshsu
I may be wrong, but I think the limiting factors are missing editor features. If it would be possible to write a plugin, there would already be one

I may be wrong, but I think the limiting factors are missing editor features. If it would be possible to write a plugin, there would already be one

Kind of. I started to implement a merge plugin in my free time and the only thing I found to be really missing was https://github.com/microsoft/vscode/issues/85682

However, I am really grateful for the open source ide vscode 😍 So I will just be happy about everything what will be added - maybe we will even see this feature this year, as it is part of the road map 2020 😍😍

Is this feature ever coming? Visual studio mainline has 3-way merge in TFS

You maybe want to try out my new extension VS Code as Git Mergetool. It has some deficits due to lacking API but I have not received any negative feedback yet, except from myself. The proposed four-pane layout could even have some advantages over a three-column layout, however.

It’s not yet in the Marketplace, but it can be installed manually. _It is now available on the Marketplace._

I will delete webstorm when I get this feature.

Much needed :+1:

This will be a great feature <3

As a temporary solution is use online tools like https://editor.mergely.com

I have a comment here from a few years ago saying the same thing as others, and while I think an alternative three way merge view would be awesome, I actually prefer this barebones way now since it's literally just a skin over the text that git puts there.

What I want to say that this should not be a "blocker" for anyone using VSCode. Give it a try instead of reverting to an IDEA IDE for git interactions. (The only extension I recommend is Git Graph)

Was this page helpful?
0 / 5 - 0 ratings