228

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?

1

7 Answers 7

396

It's 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

4
  • 84
    what about all the files! Commented Feb 22, 2020 at 15:07
  • do we have to select conflicted files first on the left panel? Since for my case it seems we do Commented Jun 2, 2021 at 3:15
  • 6
    This only accepts conflicts for the current file Commented May 6, 2022 at 18:26
  • 1
    for me even if I select all the conflicting files and use this method, later I need to click on them one by one and click Accept Merge button.
    – Tosh
    Commented Aug 11, 2022 at 10:34
147

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

6
  • 13
    Did not work for me. The conflicts persist even after following the exact same steps. Commented Dec 9, 2020 at 8:30
  • 2
    Turns out this only works when only files are selected and their parent directories are excluded. You can select each file holding Ctrl key and then choose the option Select All Changes from the cascade menu. All the files will open with unsaved changes. To save all the unsaved files at once, do File > Save All. Commented Dec 9, 2020 at 8:37
  • 2
    If you still see conflicts - Save all Files Commented May 19, 2021 at 7:17
  • Doesn't work for me when I have 1000+ files in various directories having conflicts. Clicking the Accept all current option doesn't do anything (Accept all incoming works though). I had to select files in groups of about 30 files and select the option, followed by Save all and Close all Commented Aug 4, 2022 at 14:49
  • 1
    I have one conflicting file. It's binary (don't judge) so I can't preview changes. Right click / select that one file, "Accept all Incoming" does nothing. Same with command palette action. Commented Aug 9, 2022 at 15:32
41

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

Screenshot of described step.

2
  • Hi komoLei, can you please give a better explanation to your problem? Commented Mar 19, 2020 at 5:44
  • Except this never works.
    – Radzor
    Commented Aug 7 at 20:53
40

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
  • 3
    After running this command, "Unmerged paths" remain until running git add --all which is very confusing... because they are... merged. Commented Aug 9, 2022 at 15:38
4
  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.
2

Unfortunately, none of the answers here worked for me. However, I was able to accept all incoming changes by running these commands manually.

I was in the conflict state at this point so I had to abort the merge and then pull all "their" (incoming) changes.

git merge --abort
git pull -X theirs
1
  • this kinda worked for me, though it brought up a text editor showing changes... i had one conflicting file, didn't really care about my local changes to said file
    – orgg
    Commented May 17 at 0:17
-1

After accepting all upcoming changes, I have to unstage all changes and stage the changes again to make it work enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.