Let’s, for instance, say we are merging changes from main into the current branch
git merge main
Now, assuming we didn’t change any Golang test files—i.e. those ending with _test.go—and simply want to resolve the conflicting changes by taking over the changes on main, then we may run
git checkout --theirs **/*_test.go
(And vice versa using git checkout --ours **/*_test.go if we want to resolve conflicts by keeping the changes in the current working tree.)
If we also want to delete files that were deleted in the current working tree or main, we may additionally pass the --no-overlay option.
For example,
git checkout --theirs --no-overlay **/*_test.go
resolves conflicts on Go test files in favor of the changes on main and, moreover, deletes matching files from the current working tree, if they were deleted on the main branch.