What are the different merge strategies in Git (ort/recursive, ours, octopus), and when does each apply?
Last updated
ort(default, a faster rewrite ofrecursive) three-way merges two heads. If there are multiple common ancestors, it first merges them into one virtual base.oursrecords a merge but keeps the current branch's tree entirely, marking a branch as merged without taking its changes.octopusmerges three or more branches at once and refuses if any conflict arises.-X ours/theirsis a strategy option, not a strategy: it auto-resolves only conflicting hunks toward one side while merging the rest.
- https://git-scm.com/docs/merge-strategies
- https://www.atlassian.com/git/tutorials/using-branches/merge-strategy
- https://mattrickard.com/git-merge-strategies-and-algorithms
- https://lithiumgit.com/blogs/stop-guessing-choose-the-right-git-merge-strategy-every-time
- https://www.geeksforgeeks.org/git/merge-strategies-in-git/
- https://blog.devops.dev/how-to-merge-multiple-branches-at-once-with-git-octopus-merging-ec3e58bd486e
- https://dev.to/thezal/monstrous-git-merge-strategies-navigating-the-dungeons-of-version-control-37ch