When merging topic branch "B" into "A" using git merge, I get some conflicts. I know all the conflicts can be solved using the version in "B".
I am aware of git merge -s ours. But what I want is something like git merge -s theirs.
Why doesn’t it exist? How can I achieve the same result after the conflicting merge with existing git commands? (git checkout every unmerged file from B)
The "solution" of just discarding anything from branch A (the merge commit point to B version of the tree) is not what I am looking for.
A similar alternative is the
--strategy-option(short form-X) option, which acceptstheirs. For example:However, this is more equivalent to
-X oursthan-s ours. The key difference being that-Xperforms a regular recursive merge, resolving any conflicts using the chosen side, whereas-s ourschanges the merge to just completely ignore the other side.In some cases, the main problem using
-X theirsinstead of the hypothetical-s theirsis deleted files. In this case, just rungit rmwith the name of any files that were deleted:After that, the
-X theirsmay work as expected.Of course, doing the actual removal with the
git rmcommand will prevent the conflict from happening in the first place.