What is the difference between the git merge option
--strategy-option
(short -X
)
and
--strategy
(short -s
)?
There are a lot of questions regarding merge strategies. But none explain the difference between these options.
Also the git documentation is not helpful:
--strategy-option Pass merge strategy specific option through to the merge strategy.
The most commonly used strategies are Fast Forward Merge and Recursive Merge. In this most commonly used merge strategy, history is just one straight line. When you create a branch, make some commits in that branch, the time you're ready to merge, there is no new merge on the master.
Using git rebase Instead of git merge. Using the "git merge" command is probably the easiest way to integrate changes from one branch into another. However, it's not your only option: "git rebase" offers another, slightly different way of integration.
octopus - This resolves more than two-head case, but refuses to do complex merge that needs manual resolution. It is primarily meant to be used for bundling topic branch heads together. This is the default merge strategy when pulling or merging more than one branches.
It is called so because, in the 3-way merge, Git uses three commits to generate the merge commit; two branch tips and their common ancestor. Typically, the fast forward merge is used by developers for small features or bug fixes while the 3-way merge is reserved for integrating longer-running features.
TL;DR: -s
is for specifying a merge strategy -X
is for supplying options for said strategy.
The git documentation says:
-s <strategy>
--strategy=<strategy>
Use the given merge strategy; can be supplied more than once to specify them in the order they should be tried. If there is no -s option, a built-in list of strategies is used instead (git merge-recursive when merging a single head, git merge-octopus otherwise).
-X <option>
--strategy-option=<option>
Pass merge strategy specific option through to the merge strategy.
Additionally, further down the chapter MERGE STRATEGIES explains all the available strategies and their options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With