How do I select a merge strategy for a git rebase?

You can use this with Git v1.7.3 or later versions.

git rebase --strategy-option theirs ${branch} # Long option
git rebase -X theirs ${branch} # Short option

(which is a short for git rebase --strategy recursive --strategy-option theirs ${branch} as stated by the documentation)

From Git v1.7.3 Release Notes:

git rebase --strategy <s> learned the --strategy-option/-X option to pass extra options that are understood by the chosen merge strategy.

NB: “Ours” and “theirs” mean the opposite of what they do during a straight merge. In other words, “theirs” favors the commits on the current branch.

Leave a Comment