Kornel Kornel - 1 year ago 166
Git Question

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

man page mentions
can be passed to
. When/how exactly?

I'd like to rebase by applying patches with recursive strategy and theirs option (apply whatever sticks, rather than skipping entire conflicting commits). I don't want merge, I want to make history linear.

I've tried:

git rebase -Xtheirs


git rebase -s 'recursive -Xtheirs'

but git rejects
in both cases.

git rebase -Xtheirs
works in recent versions, except tree conflicts need to be resolved manually. You need to run
git rebase -Xtheirs --continue
repeated) after resolving those conflicts.

Answer Source

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

git rebase -s recursive -X theirs ${branch}

From Git v1.7.3 Release Notes:

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

Update: Edited to be clearer.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download