I have an issue where I am merging in a branch that has produced over 50 files of merge conflicts. The only merge conflicts I was concerned about are the ones that affected the files I recently changed. I went and manually resolved and staged those files. Now 44 files remain. I would just like to accept incoming for all of them. Is there a way I can do that, either through git or vscode? Every solution i found online is resolving all or none, and vscode can only accept incoming conflicts for 1 file, not multiple files.
Asked
Active
Viewed 1,263 times
1 Answers
2
You could fetch the list of remaining conflicting files with
git diff --name-only --diff-filter=U
Once you've got that you can just checkout each of them from the branch being merged in.
git diff --name-only --diff-filter=U | xargs git checkout --theirs --
Your working tree will now have only the changes from the branch you're merging in so you can just stage and commit everything.

Calum Halpin
- 1,945
- 1
- 10
- 20
-
1Use `--theirs` for `
`, but the general principle is good. Upvoted. – Romain Valeri Jul 27 '19 at 01:13 -
That's great, I didn't realise `checkout` was aware of merges like that. – Calum Halpin Jul 27 '19 at 02:18
-
1Yeah, very handy to have it available, along with `--ours` (or `-m` to restore the conflicted state if needed) – Romain Valeri Jul 27 '19 at 10:45