a5ae14fba56da599e9f0b099e04ea440fa9c8333
   1MERGE STRATEGIES
   2----------------
   3
   4The merge mechanism ('git-merge' and 'git-pull' commands) allows the
   5backend 'merge strategies' to be chosen with `-s` option.  Some strategies
   6can also take their own options, which can be passed by giving `-X<option>`
   7arguments to 'git-merge' and/or 'git-pull'.
   8
   9resolve::
  10        This can only resolve two heads (i.e. the current branch
  11        and another branch you pulled from) using a 3-way merge
  12        algorithm.  It tries to carefully detect criss-cross
  13        merge ambiguities and is considered generally safe and
  14        fast.
  15
  16recursive::
  17        This can only resolve two heads using a 3-way merge
  18        algorithm.  When there is more than one common
  19        ancestor that can be used for 3-way merge, it creates a
  20        merged tree of the common ancestors and uses that as
  21        the reference tree for the 3-way merge.  This has been
  22        reported to result in fewer merge conflicts without
  23        causing mis-merges by tests done on actual merge commits
  24        taken from Linux 2.6 kernel development history.
  25        Additionally this can detect and handle merges involving
  26        renames.  This is the default merge strategy when
  27        pulling or merging one branch.
  28+
  29The 'recursive' strategy can take the following options:
  30
  31ours;;
  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+
  36This should not be confused with the 'ours' merge strategy, which does not
  37even look at what the other tree contains at all.  It discards everything
  38the other tree did, declaring 'our' history contains all that happened in it.
  39
  40theirs;;
  41        This is opposite of 'ours'.
  42
  43patience;;
  44        With this option, 'merge-recursive' spends a little extra time
  45        to avoid mismerges that sometimes occur due to unimportant
  46        matching lines (e.g., braces from distinct functions).  Use
  47        this when the branches to be merged have diverged wildly.
  48        See also linkgit:git-diff[1] `--patience`.
  49
  50renormalize;;
  51        This runs a virtual check-out and check-in of all three stages
  52        of a file when resolving a three-way merge.  This option is
  53        meant to be used when merging branches with different clean
  54        filters or end-of-line normalization rules.  See "Merging
  55        branches with differing checkin/checkout attributes" in
  56        linkgit:gitattributes[5] for details.
  57
  58no-renormalize;;
  59        Disables the `renormalize` option.  This overrides the
  60        `merge.renormalize` configuration variable.
  61
  62subtree[=path];;
  63        This option is a more advanced form of 'subtree' strategy, where
  64        the strategy makes a guess on how two trees must be shifted to
  65        match with each other when merging.  Instead, the specified path
  66        is prefixed (or stripped from the beginning) to make the shape of
  67        two trees to match.
  68
  69octopus::
  70        This resolves cases with more than two heads, but refuses to do
  71        a complex merge that needs manual resolution.  It is
  72        primarily meant to be used for bundling topic branch
  73        heads together.  This is the default merge strategy when
  74        pulling or merging more than one branch.
  75
  76ours::
  77        This resolves any number of heads, but the resulting tree of the
  78        merge is always that of the current branch head, effectively
  79        ignoring all changes from all other branches.  It is meant to
  80        be used to supersede old development history of side
  81        branches.  Note that this is different from the -Xours option to
  82        the 'recursive' merge strategy.
  83
  84subtree::
  85        This is a modified recursive strategy. When merging trees A and
  86        B, if B corresponds to a subtree of A, B is first adjusted to
  87        match the tree structure of A, instead of reading the trees at
  88        the same level. This adjustment is also done to the common
  89        ancestor tree.