Yes. In fact, there is not one way to do this.
The rebase and merge commands (and usually cherry picks) accept the same strategy and -X flags to go to the basic git merge mechanism. For the recursive -Xours and -Xtheirs select one or the other “sides” of the files in the case of a file modified in both branches that merge.
Or - this is completely different - in cases where the merger stops with a conflict, you can use git checkout with the --ours or --theirs flags to select a version from either side. (You can do this with other commands, here I will stick with --ours and --theirs , since they match the arguments of commands using merge mechanisms.)
This, of course, is different, because you can switch the selection:
$ git checkout main Switched to branch 'main' $ git merge branch ... conflicts in files A and B ... $ git checkout --ours -- A
Please note that this is very different from “our strategy” (the above strategy is “ recursive with ours option”). With “our strategy,” something completely different is happening. Start without it, re-merge again:
$ git checkout main && git merge branch ... conflicts ... $ git checkout --ours -- AB
Say there is a third C file that git can merge on its own. When you do the above, git combines C , and you take main:A and main:B If you used git merge --strategy=ours branch , then git would take main:A , main:B and main:C It would branch:C changes, rather than automatically merging them.
I used git merge above because it makes “our” and “my” stuff “right”. I don't like git names, however, because when you rebase, our / their version becomes a replacement, because rebase works by going to the "other" branch and making a series of cherry picks. I.e:
$ git checkout mine; git rebase theirs
works under the influence of a (very) gross equivalent:
$ git checkout theirs; git cherry-pick theirs..mine
and then after that we shuffle the branch marks around so that theirs branch does not actually move. (This is not so bad inside :-), but he really does --ours means "them" and --theirs means "ours", which is pretty bad from the outside.)