Skip to content

Commit 68d5610

Browse files
newrenderrickstolee
authored andcommitted
Update docs for change of default merge backend
Make it clear that `ort` is the default merge strategy now rather than `recursive`, including moving `ort` to the front of the list of merge strategies. Signed-off-by: Elijah Newren <[email protected]>
1 parent 9cbb481 commit 68d5610

File tree

5 files changed

+67
-60
lines changed

5 files changed

+67
-60
lines changed

Documentation/git-rebase.txt

+14-14
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,8 @@ See also INCOMPATIBLE OPTIONS below.
352352

353353
-s <strategy>::
354354
--strategy=<strategy>::
355-
Use the given merge strategy, instead of the default
356-
`recursive`. This implies `--merge`.
355+
Use the given merge strategy, instead of the default `ort`.
356+
This implies `--merge`.
357357
+
358358
Because 'git rebase' replays each commit from the working branch
359359
on top of the <upstream> branch using the given strategy, using
@@ -366,7 +366,7 @@ See also INCOMPATIBLE OPTIONS below.
366366
--strategy-option=<strategy-option>::
367367
Pass the <strategy-option> through to the merge strategy.
368368
This implies `--merge` and, if no strategy has been
369-
specified, `-s recursive`. Note the reversal of 'ours' and
369+
specified, `-s ort`. Note the reversal of 'ours' and
370370
'theirs' as noted above for the `-m` option.
371371
+
372372
See also INCOMPATIBLE OPTIONS below.
@@ -527,7 +527,7 @@ The `--rebase-merges` mode is similar in spirit to the deprecated
527527
where commits can be reordered, inserted and dropped at will.
528528
+
529529
It is currently only possible to recreate the merge commits using the
530-
`recursive` merge strategy; different merge strategies can be used only via
530+
`ort` merge strategy; different merge strategies can be used only via
531531
explicit `exec git merge -s <strategy> [...]` commands.
532532
+
533533
See also REBASING MERGES and INCOMPATIBLE OPTIONS below.
@@ -1216,16 +1216,16 @@ successful merge so that the user can edit the message.
12161216
If a `merge` command fails for any reason other than merge conflicts (i.e.
12171217
when the merge operation did not even start), it is rescheduled immediately.
12181218

1219-
By default, the `merge` command will use the `recursive` merge
1220-
strategy for regular merges, and `octopus` for octopus merges. One
1221-
can specify a default strategy for all merges using the `--strategy`
1222-
argument when invoking rebase, or can override specific merges in the
1223-
interactive list of commands by using an `exec` command to call `git
1224-
merge` explicitly with a `--strategy` argument. Note that when
1225-
calling `git merge` explicitly like this, you can make use of the fact
1226-
that the labels are worktree-local refs (the ref `refs/rewritten/onto`
1227-
would correspond to the label `onto`, for example) in order to refer
1228-
to the branches you want to merge.
1219+
By default, the `merge` command will use the `ort` merge strategy for
1220+
regular merges, and `octopus` for octopus merges. One can specify a
1221+
default strategy for all merges using the `--strategy` argument when
1222+
invoking rebase, or can override specific merges in the interactive
1223+
list of commands by using an `exec` command to call `git merge`
1224+
explicitly with a `--strategy` argument. Note that when calling `git
1225+
merge` explicitly like this, you can make use of the fact that the
1226+
labels are worktree-local refs (the ref `refs/rewritten/onto` would
1227+
correspond to the label `onto`, for example) in order to refer to the
1228+
branches you want to merge.
12291229

12301230
Note: the first command (`label onto`) labels the revision onto which
12311231
the commits are rebased; The name `onto` is just a convention, as a nod

Documentation/gitfaq.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ best to always use a regular merge commit.
275275

276276
[[merge-two-revert-one]]
277277
If I make a change on two branches but revert it on one, why does the merge of those branches include the change?::
278-
By default, when Git does a merge, it uses a strategy called the recursive
278+
By default, when Git does a merge, it uses a strategy called the `ort`
279279
strategy, which does a fancy three-way merge. In such a case, when Git
280280
performs the merge, it considers exactly three points: the two heads and a
281281
third point, called the _merge base_, which is usually the common ancestor of

Documentation/merge-options.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ With --squash, --commit is not allowed, and will fail.
112112
Use the given merge strategy; can be supplied more than
113113
once to specify them in the order they should be tried.
114114
If there is no `-s` option, a built-in list of strategies
115-
is used instead (`recursive` when merging a single head,
115+
is used instead (`ort` when merging a single head,
116116
`octopus` otherwise).
117117

118118
-X <option>::

Documentation/merge-strategies.txt

+50-43
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,23 @@ backend 'merge strategies' to be chosen with `-s` option. Some strategies
66
can also take their own options, which can be passed by giving `-X<option>`
77
arguments to `git merge` and/or `git pull`.
88

9-
recursive::
10-
This can only resolve two heads using a 3-way merge
11-
algorithm. When there is more than one common
12-
ancestor that can be used for 3-way merge, it creates a
13-
merged tree of the common ancestors and uses that as
14-
the reference tree for the 3-way merge. This has been
15-
reported to result in fewer merge conflicts without
16-
causing mismerges by tests done on actual merge commits
17-
taken from Linux 2.6 kernel development history.
18-
Additionally this can detect and handle merges involving
19-
renames. It does not make use of detected copies. This
20-
is the default merge strategy when pulling or merging one
21-
branch.
9+
ort::
10+
This is the default merge strategy when pulling or merging one
11+
branch. This strategy can only resolve two heads using a
12+
3-way merge algorithm. When there is more than one common
13+
ancestor that can be used for 3-way merge, it creates a merged
14+
tree of the common ancestors and uses that as the reference
15+
tree for the 3-way merge. This has been reported to result in
16+
fewer merge conflicts without causing mismerges by tests done
17+
on actual merge commits taken from Linux 2.6 kernel
18+
development history. Additionally this strategy can detect
19+
and handle merges involving renames. It does not make use of
20+
detected copies. The name for this algorithm is an acronym
21+
("Ostensibly Recursive's Twin") and came from the fact that it
22+
was written as a replacement for the previous default
23+
algorithm, `recursive`.
2224
+
23-
The 'recursive' strategy can take the following options:
25+
The 'ort' strategy can take the following options:
2426

2527
ours;;
2628
This option forces conflicting hunks to be auto-resolved cleanly by
@@ -36,16 +38,6 @@ theirs;;
3638
This is the opposite of 'ours'; note that, unlike 'ours', there is
3739
no 'theirs' merge strategy to confuse this merge option with.
3840

39-
patience;;
40-
Deprecated synonym for `diff-algorithm=patience`.
41-
42-
diff-algorithm=[patience|minimal|histogram|myers];;
43-
Use a different diff algorithm while merging, which can help
44-
avoid mismerges that occur due to unimportant matching lines
45-
(such as braces from distinct functions). See also
46-
linkgit:git-diff[1] `--diff-algorithm`. Defaults to the
47-
`diff.algorithm` config setting.
48-
4941
ignore-space-change;;
5042
ignore-all-space;;
5143
ignore-space-at-eol;;
@@ -74,11 +66,6 @@ no-renormalize;;
7466
Disables the `renormalize` option. This overrides the
7567
`merge.renormalize` configuration variable.
7668

77-
no-renames;;
78-
Turn off rename detection. This overrides the `merge.renames`
79-
configuration variable.
80-
See also linkgit:git-diff[1] `--no-renames`.
81-
8269
find-renames[=<n>];;
8370
Turn on rename detection, optionally setting the similarity
8471
threshold. This is the default. This overrides the
@@ -95,19 +82,39 @@ subtree[=<path>];;
9582
is prefixed (or stripped from the beginning) to make the shape of
9683
two trees to match.
9784

98-
ort::
99-
This is meant as a drop-in replacement for the `recursive`
100-
algorithm (as reflected in its acronym -- "Ostensibly
101-
Recursive's Twin"), and will likely replace it in the future.
102-
It fixes corner cases that the `recursive` strategy handles
103-
suboptimally, and is significantly faster in large
104-
repositories -- especially when many renames are involved.
85+
recursive::
86+
This can only resolve two heads using a 3-way merge
87+
algorithm. When there is more than one common
88+
ancestor that can be used for 3-way merge, it creates a
89+
merged tree of the common ancestors and uses that as
90+
the reference tree for the 3-way merge. This has been
91+
reported to result in fewer merge conflicts without
92+
causing mismerges by tests done on actual merge commits
93+
taken from Linux 2.6 kernel development history.
94+
Additionally this can detect and handle merges involving
95+
renames. It does not make use of detected copies. This was
96+
the default strategy for resolving two heads from Git v0.99.9k
97+
until v2.33.0.
10598
+
106-
The `ort` strategy takes all the same options as `recursive`.
107-
However, it ignores three of those options: `no-renames`,
108-
`patience` and `diff-algorithm`. It always runs with rename
109-
detection (it handles it much faster than `recursive` does), and
110-
it specifically uses `diff-algorithm=histogram`.
99+
The 'recursive' strategy takes the same options as 'ort'. However,
100+
there are three additional options that 'ort' ignores (not documented
101+
above) that are potentially useful with the 'recursive' strategy:
102+
103+
patience;;
104+
Deprecated synonym for `diff-algorithm=patience`.
105+
106+
diff-algorithm=[patience|minimal|histogram|myers];;
107+
Use a different diff algorithm while merging, which can help
108+
avoid mismerges that occur due to unimportant matching lines
109+
(such as braces from distinct functions). See also
110+
linkgit:git-diff[1] `--diff-algorithm`. Note that `ort`
111+
specifically uses `diff-algorithm=histogram`, while `recursive`
112+
defaults to the `diff.algorithm` config setting.
113+
114+
no-renames;;
115+
Turn off rename detection. This overrides the `merge.renames`
116+
configuration variable.
117+
See also linkgit:git-diff[1] `--no-renames`.
111118

112119
resolve::
113120
This can only resolve two heads (i.e. the current branch
@@ -131,13 +138,13 @@ ours::
131138
the 'recursive' merge strategy.
132139

133140
subtree::
134-
This is a modified recursive strategy. When merging trees A and
141+
This is a modified ort strategy. When merging trees A and
135142
B, if B corresponds to a subtree of A, B is first adjusted to
136143
match the tree structure of A, instead of reading the trees at
137144
the same level. This adjustment is also done to the common
138145
ancestor tree.
139146

140-
With the strategies that use 3-way merge (including the default, 'recursive'),
147+
With the strategies that use 3-way merge (including the default, 'ort'),
141148
if a change is made on both branches, but later reverted on one of the
142149
branches, that change will be present in the merged result; some people find
143150
this behavior confusing. It occurs because only the heads and the merge base

Documentation/user-manual.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -3190,7 +3190,7 @@ that *updated* thing--the old state that you added originally ends up
31903190
not being pointed to by any commit or tree, so it's now a dangling blob
31913191
object.
31923192

3193-
Similarly, when the "recursive" merge strategy runs, and finds that
3193+
Similarly, when the "ort" merge strategy runs, and finds that
31943194
there are criss-cross merges and thus more than one merge base (which is
31953195
fairly unusual, but it does happen), it will generate one temporary
31963196
midway tree (or possibly even more, if you had lots of criss-crossing

0 commit comments

Comments
 (0)