103

I am trying to resolve merge conflicts into a branch using vs code. However the command palette to accept incoming changes is not appearing

enter image description here

Unlike here where the command palette is clearly visible at the top window.

How do I get those commands to appear at top of window?

Community
  • 1
  • 1
RyeGuy
  • 4,213
  • 10
  • 33
  • 57

14 Answers14

159

Update (August 2022 - version 1.71):

Disabled old conflict decorators, caused by automatically enabled git merge editor is no longer an issue. With the new release the merge editor and the old inline experience can now be used together.

You can also easily switch between the two with a single click.
Check Release Notes - Merge editor improvements to see how.

If you still can't see "Accept Change(s)" after updating VS Code, refer to answer by Bruno Monteiro.

Legacy (July 2022 - version 1.70):

You may not also be able to see "Accept Change(s)" because recently VS Code introduced Git merge editor, which is now enabled by default.

It allows you to view and resolve merge conflicts by clicking on a conflicting file in the Source Control view instead. You can turn it off to go back to "Accept Change(s)", though I think it's better.

Add this line to VS Code user settings.json to turn merge editor off: "git.mergeEditor": false

I'm attaching screenshots for anyone want to compare merge.editor off & on:
Git merge editor - off
Git merge editor - on

NOTE:

If you like the new merge editor, you can bring it up from the terminal. Add the following to your .gitconfig, and then run - git mergetool

[merge]
    tool = vscode
[mergetool "vscode"]
    cmd = code --wait --merge $REMOTE $LOCAL $BASE $MERGED
[mergetool]
    keepBackup = false
13ibrahimov
  • 1,691
  • 2
  • 5
  • 4
  • 26
    Thanks, 1hr fixing finally ended. Setting this in the VSCode settings (Ctrl + ,) then JSON-view fixed it: ```"git.mergeEditor": false``` – baltzar Aug 08 '22 at 12:39
  • 7
    This definitely works, but...why? So confused! You need to turn off the Git option to make the Git option work?? – James Toomey Aug 16 '22 at 13:56
  • 5
    @JamesToomey Yes I quite agree with you that the two should work in unison. I believe they removed conflict markers from files opened in explorer, so code lens doesn't appear in the new merge editor window, but then this completely recks the old view. The good news is they agree too! I think they've merged a hotfix pull request few days ago which will keep conflict marker decorators even if merge editor is enabled. August release will probably solve this, and I'll try to update my answer accordingly. – 13ibrahimov Aug 17 '22 at 13:09
  • 2
    Wow. Just wow. Hours of my life down the drain. Thank you SO much for ending my pain. :D This MS "update" (aka disabling of a completely satisfactory feature) totally broke my workflow. – Luke Aug 25 '22 at 06:13
  • Thank you very, very much. For the last couple weeks I thought I went insane. Now I’m good again. Would be nice if VSCode had a simple option to switch merge editor on/off via the dots icon in the top right corner. – Marijan Aug 25 '22 at 09:13
  • I can't make sense of the choice to release a version that causes devs to spin in place (or go back to the CLI) until they read the changelogs, docs, find a clever fellow on SO, etc. I updated VSC and a new Merge Editor appeared that gave me yellow boxes with nothing to click. Give me vimdiff or _something_ until I can figure out what the new feature is. For all the wonders that come with VSC, this is out of character. – benJephunneh Jan 05 '23 at 16:03
68

What resolved this for me was to disable Git Merge Editor. You can find this in File > Preferences > Settings and then search for Git Merge Editor. After unticking the box, you should restart VS Code.

enter image description here

anosha_rehan
  • 1,522
  • 10
  • 17
50

In my case I had a different issue, my "Code Lens" was disabled.

You can go to Settings and search for "codeLens" to make sure it is enabled.

Bruno Monteiro
  • 4,153
  • 5
  • 29
  • 48
28

In case someone still can't solve this issue. You can turn off the Git: Merge Editor from Setting menu.

enter image description here

VSCode merge conflict options not displaying

Ganda Rain Panjaitan
  • 833
  • 1
  • 12
  • 28
20

I suppose you're looking for this toolbar:

VS Code merge conflict toolbar

(Image from this Microsoft Repo)

This toolbar only appears when:

  1. there are any merge conflicts and
  2. the current file is in the "MERGE" section of VS Code's version control panel

From what I see in your screenshot, there is indeed a file in the "MERGE" section. I can't really tell whether that is also the file you've opened (Address.js).

Address.js seems to have no conflict markers. In git, conflict markers look like this:

<<<<<<< HEAD
    ...
=======
    ...
>>>>>>> master

In your case it seems like the change was merged by git automatically, without conflicts, which means the toolbar you're looking for won't show here.

Fabian Lauer
  • 8,891
  • 4
  • 26
  • 35
  • 2
    I've noticed that for very large repos, where there are lots of changes in the merge, it can take up to 2-3 minutes for the `Accept Current Change | Accept Incoming Change | ...` toolbar to show up. – cschadl Feb 16 '22 at 16:37
  • It took quite a while for it to show up in my VSCode too, even though it was a small change. Thanks for the tip @cschadl – Phill Healey Apr 08 '22 at 16:58
  • Can anyone please provide equivalent terminal git commands for "Accept incoming change"/"Accept current change"? – Paris Nov 10 '22 at 05:29
19

In VScode settings (cmd + P , json settings) set:

  "editor.codeLens": true,

Mine was set to false and the commit actions weren't showing up.

Taken from the links in @Teresa Kozeras answer.

Set to True: enter image description here

Set to False: enter image description here

This isn't exactly the question OP asked, but it's the one I was having when google brought me here.

sirclesam
  • 2,109
  • 17
  • 13
7

enter image description hereTry to change "git.mergeEditor": false in your VS code settings.

6

I hope this help somebody. If the Accept Current Changes and stuff does not appear when git rebasing.

enter image description here

Just cut the greater than >>>>>>>> [Commit message] and paste it in any lines after the equal ======= signs and within those signs are the codes for Accept Incoming Changes.

Quer
  • 405
  • 7
  • 16
  • I got the same problem. Git markers are probably wrong because the tool shows up when I manually added the markers – Shnigi Aug 24 '22 at 06:46
6

This just happened to me too, the solution for me was to open settings (command+comma), search for merge, and disable Git: Merge Editor. enter image description here

Nikhith sunil
  • 229
  • 3
  • 4
6

Below is the most simple, easy and fast way for all:

Disable Git Merge Editor.

  1. Go to File > Preferences > Settings in VS code enter image description here
  2. Search for Git: Merge Editor. enter image description here
  3. Untick the check box and restart Vs Code

Enjoy!!!!!!!!!!!!!!!!

V_for_Vj
  • 849
  • 1
  • 12
  • 30
4

First, as I found out, there are two types of related views, a diff/compare view (red/green lines) and a conflict (azure lines as seen in you gif) view.

IF you have a merge conflict, the file in the sidebar will be put under "MERGE CHANGES", and you can click it and it opens like a regular file (just the filename in the tab and nothing else).

However, I had a problem of not seeing any conflict highlighting or toolbar to accept or revert changes, until I figured that it doesn't scroll to the conflict automatically (I had a 40k lines file), and the only way you can spot conflicts as far as I can see, is in the scrollbar with small azure colorings. Then when you scroll to them, the conflict and related actions appear. That's on VS Code, I think, to implement such changes (auto scroll to first conflict, as well as separate buttons to go to next/previous conflict). There are keybind options, though.

Cheers

emboel
  • 169
  • 2
  • 10
1

I had the same problem after having some strange update issue with vscode. I just had to uninstall and install the latest(1.27.1 at the time of writing) version of vscode and it worked again.

Gásten
  • 123
  • 3
  • 8
0

I had the same issue and I struggled for hours and nothing worked then the problem solved just by restarting the vs code

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 20 '22 at 01:26