How can I accept all current changes in VSCode at once?

Viewed 108647

I tried to merge one file with another file, but there are many HEADs with Accept Current Change | Accept Incoming Change | ...

Is there a way to accept all current changes at once?

5 Answers

Its very easy just go to vs code and press Ctrl+shift+p (command palette) or go to view and open command palette manually and type "merge" in your command palette, now you can see the Accept all current changes.

you can see image here

select the list of files to resolve from the MERGE-CHANGES section, then right-click your mouse and select Accept all incoming. That should do the trick for all files.

You will need to save the updated files once the conflicts are resolved. Click File and then Save All

Select list of files

Right click and choose Accept all incoming

Click File and then Save All

Select target file, right click and choose 'Accept All Incoming'.

Screenshot of described step.

As For VSCode MacOS, I've done Accept All Incoming from Merge Changes section, but it didn't affect all (that may be a bug, or I don't know why). So, I used the conventional way with command line, and it worked.
For accepting all incoming changes,

git checkout --theirs .

or
For accepting all current changes,

git checkout --ours .

P.S. Hope it helps for those who need to solve merging conflict first in any case.

  1. Select all files in Merge Changes section.
  2. Choose Open File from right click menu. It opens all files.
  3. Select all files again.
  4. Choose appropriate menu from right click. eg. Accept All Current.
  5. Choose Save All from File menu.
Related