Home > front end >  How do I resolve this merge conflict in vscode?
How do I resolve this merge conflict in vscode?

Time:08-10

I know there are many articles and questions covering this topic, but none of them seem to be offering a solution to my issue. I basically created a new branch from develop, and then I checkout into it, and then I ran git merge origin develop in order to merge the develop into my new branch, but I got this error: Error

I clicked on the source control button from the left sidebar, and this is what I get: enter image description here

If I click on Merge Changes dropdown, I see two files - package-lock.json and package.json. When I click on either one of them, the right side of the vscode gets split into two, and it shows yours and theirs screens, and beneath result, and there's a 1 conflicts remaining text too, and there's also a Accept Merge button, but when I click it, a window pops up asking me if I want to continue with conflicts.

This morning I screwed up the project of the company, and I still feel really bad about it, but I still don't get how do I fix this? They told me I have to resolve the merge conflict, but I don't know how. I've never done this before. I am looking at the two split screens, and I don't see any lines emphasized in red for me to "resolve". There are just lines emphasized in green.

Isn't there a button I can just click, and be shown the "conflict"? How do I know how to resolve, and how do I resolve it?

CodePudding user response:

As torek mentioned, you should only resolve the conflicts manually for package.json and let package-lock.json be regenerated. Resolving conflicts can be simple or difficult, it depends.

However what really helps is to use a proper 3-way merge tool that shows three sources: common base version, merge from version and merge to version, along with a destination output where you resolve conflicts into.

Kdiff3 is a merge tool that supports this, and if you use my git-resolve-conflict-using-kdiff3 script it will automatically launch kdiff3 with all the appropriate versions.

  • Related