Reputation: 6667
I tried to merge my branch with another branch and there was a merge conflict. In Visual Studio Code (version 1.2.1) I resolved all of the issues, however when I try to commit it keeps giving me this message:
You should first resolve the un-merged changes before committing your changes.
I've tried googling it but I can't find out why it won't let me commit my changes, all of the conflicts have disappeared.
Upvotes: 285
Views: 705294
Reputation: 293
If there are conflicts: Use vs-code to solve them file by file. Click button "complete merge" in vs-code after every file. When there are no files left, run command:
git commit
( Don't rely on the vs-code "commit" button, it will be grayed out, which is wrong. )
Upvotes: 2
Reputation: 5297
For VSCode 1.70.2 in merge view from source control panel there are checkboxes on "yours" and "theirs" sides, next to the line numbers in the middle of selected conflict block, instead of text buttons above lines.
Upvotes: 0
Reputation: 15683
For those who are having a hard time finding the "merge buttons".
The little lightbulb icon with the merge options only shows up if you click precisely on the "merge conflict marker":
<<<<<<<
Steps (in VS Code 1.29.x):
Upvotes: 49
Reputation: 222712
With VSCode you can find the merge conflicts easily with the following UI.
(if you do not have the topbar, set "editor.codeLens": true
in User Preferences)
It indicates the current change that you have and incoming change from the server. This makes it easy to resolve the conflicts - just press the buttons above <<<< HEAD
.
If you have multiple changes and want to apply all of them at once - open command palette (View -> Command Palette) and start typing merge - multiple options will appear including Merge Conflict: Accept Incoming
, etc.
Upvotes: 266
Reputation: 1131
For VS Code 1.38 or if you could not find any "lightbulb" button. Pay close attention to the greyed out text above the conflicts; there is a list of actions you can take.
Upvotes: 18
Reputation: 11488
Upvotes: 57
Reputation: 522516
The error message you are getting is a result of Git still thinking that you have not resolved the merge conflicts. In fact, you already have, but you need to tell Git that you have done this by adding the resolved files to the index.
This has the side effect that you could actually just add the files without resolving the conflicts, and Git would still think that you have. So you should be diligent in making sure that you have really resolved the conflicts. You could even run the build and test the code before you commit.
Upvotes: 17
Reputation: 6667
After trial and error I discovered that you need to stage the file that had the merge conflict, then you can commit the merge.
Upvotes: 187