Skip to content

Commit 566c511

Browse files
committed
Document that merge strategies can now take their own options
Also document the recently added -Xtheirs, -Xours and -Xsubtree[=path] options to the merge-recursive strategy. Signed-off-by: Avery Pennarun <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e3cba96 commit 566c511

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

Documentation/merge-options.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,8 @@ option can be used to override --squash.
7474
-v::
7575
--verbose::
7676
Be verbose.
77+
78+
-X <option>::
79+
--strategy-option=<option>::
80+
Pass merge strategy specific option through to the merge
81+
strategy.

Documentation/merge-strategies.txt

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
MERGE STRATEGIES
22
----------------
33

4+
The merge mechanism ('git-merge' and 'git-pull' commands) allows the
5+
backend 'merge strategies' to be chosen with `-s` option. Some strategies
6+
can also take their own options, which can be passed by giving `-X<option>`
7+
arguments to 'git-merge' and/or 'git-pull'.
8+
49
resolve::
510
This can only resolve two heads (i.e. the current branch
611
and another branch you pulled from) using a 3-way merge
@@ -20,6 +25,27 @@ recursive::
2025
Additionally this can detect and handle merges involving
2126
renames. This is the default merge strategy when
2227
pulling or merging one branch.
28+
+
29+
The 'recursive' strategy can take the following options:
30+
31+
ours;;
32+
This option forces conflicting hunks to be auto-resolved cleanly by
33+
favoring 'our' version. Changes from the other tree that do not
34+
conflict with our side are reflected to the merge result.
35+
+
36+
This should not be confused with the 'ours' merge strategy, which does not
37+
even look at what the other tree contains at all. It discards everything
38+
the other tree did, declaring 'our' history contains all that happened in it.
39+
40+
theirs;;
41+
This is opposite of 'ours'.
42+
43+
subtree[=path];;
44+
This option is a more advanced form of 'subtree' strategy, where
45+
the strategy makes a guess on how two trees must be shifted to
46+
match with each other when merging. Instead, the specified path
47+
is prefixed (or stripped from the beginning) to make the shape of
48+
two trees to match.
2349

2450
octopus::
2551
This resolves cases with more than two heads, but refuses to do
@@ -33,7 +59,8 @@ ours::
3359
merge is always that of the current branch head, effectively
3460
ignoring all changes from all other branches. It is meant to
3561
be used to supersede old development history of side
36-
branches.
62+
branches. Note that this is different from the -Xours option to
63+
the 'recursive' merge strategy.
3764

3865
subtree::
3966
This is a modified recursive strategy. When merging trees A and

0 commit comments

Comments
 (0)