Resolved git merge conflict in VS Code, but still says unresolved

24,510

Solution 1

It is an normal behavior. Usually we will get the merge conflicts when we have changes changes in same line of source and destination files of merging.

In your case, you have resolved your conflicts in your file(i mean vs code) but it is not updated to git. So after adding Accept Incoming or Accept Current you have to do below steps,

  1. git add <conflicts resolved files>
  2. git commit -m "merge conflict resolved message"
  3. git push

Solution 2

In VSCode when you have conflicts in multiple files, they're shown in the git panel and you can open files one by one and resolve them.

When you resolve the conflicts in a file, you should save the file then click the + button of that file (shown in the image bellow).

Stage resolved file

This will result in staging the file. If you click this button and there's unresolved conflicts in that file, you'll get this message:

Are you sure you want to stage with merge conflicts?

Now if you resolve conflicts of all files and click on the + button that is above all files (to stage all files with conflict) (Shown in the image bellow), it'll still give you the same message (Although you've already resolved all conflicts).

stage all files

So I recommend that you click the + of each file individually so that you'll be sure that you resolved all conflicts before staging the file.

Note

I believe this bug is fixed in recent versions of VSCode.

Solution 3

In my case, I realized I had Auto Save turned off. I know, it's too silly. But worth checking.

Share:
24,510
midnightnoir
Author by

midnightnoir

Updated on October 22, 2020

Comments

  • midnightnoir
    midnightnoir over 3 years

    So I have a develop branch and topic branch. I'm using the default Terminal in Window's VS Code. While in the topic branch, I did git merge develop since I just got latest on develop branch. Now there's a simple merge conflict in one file. In VS Code, I resolved the conflict. On the code page, there's no more conflicts that you can Accept Incoming or Accept Current, but when I try to stage the file on the Source Control panel on the left, it shows a warning popup saying Are you sure you want to stage with merge conflicts?

    Is this normal? it seems like VS Code doesn't think I resolved the conflict even tho I just did, and there's no more conflict in the file. Or is there something I'm missing Git/VS Code-wise?