rebase: add documentation and test for --no-rebase-merges
As far as I can tell, --no-rebase-merges has always worked, but has never been documented. It is especially important to document it before a rebase.rebaseMerges option is introduced so that users know how to override the config option on the command line. It's also important to clarify that --rebase-merges without an argument is not the same as --no-rebase-merges and not passing --rebase-merges is not the same as passing --rebase-merges=no-rebase-cousins. A test case is necessary to make sure that --no-rebase-merges keeps working after its code is refactored in the following patches of this series. The test case is a little contrived: It's unlikely that a user would type both --rebase-merges and --no-rebase-merges at the same time. However, if an alias is defined which includes --rebase-merges, the user might decide to add --no-rebase-merges to countermand that part of the alias but leave alone other flags set by the alias. Signed-off-by: Alex Henrie <alexhenrie24@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
e25cabbf6b
commit
7e5dcec3ca
@ -529,20 +529,24 @@ See also INCOMPATIBLE OPTIONS below.
|
|||||||
|
|
||||||
-r::
|
-r::
|
||||||
--rebase-merges[=(rebase-cousins|no-rebase-cousins)]::
|
--rebase-merges[=(rebase-cousins|no-rebase-cousins)]::
|
||||||
|
--no-rebase-merges::
|
||||||
By default, a rebase will simply drop merge commits from the todo
|
By default, a rebase will simply drop merge commits from the todo
|
||||||
list, and put the rebased commits into a single, linear branch.
|
list, and put the rebased commits into a single, linear branch.
|
||||||
With `--rebase-merges`, the rebase will instead try to preserve
|
With `--rebase-merges`, the rebase will instead try to preserve
|
||||||
the branching structure within the commits that are to be rebased,
|
the branching structure within the commits that are to be rebased,
|
||||||
by recreating the merge commits. Any resolved merge conflicts or
|
by recreating the merge commits. Any resolved merge conflicts or
|
||||||
manual amendments in these merge commits will have to be
|
manual amendments in these merge commits will have to be
|
||||||
resolved/re-applied manually.
|
resolved/re-applied manually. `--no-rebase-merges` can be used to
|
||||||
|
countermand a previous `--rebase-merges`.
|
||||||
+
|
+
|
||||||
By default, or when `no-rebase-cousins` was specified, commits which do not
|
When rebasing merges, there are two modes: `rebase-cousins` and
|
||||||
have `<upstream>` as direct ancestor will keep their original branch point,
|
`no-rebase-cousins`. If the mode is not specified, it defaults to
|
||||||
i.e. commits that would be excluded by linkgit:git-log[1]'s
|
`no-rebase-cousins`. In `no-rebase-cousins` mode, commits which do not have
|
||||||
`--ancestry-path` option will keep their original ancestry by default. If
|
`<upstream>` as direct ancestor will keep their original branch point, i.e.
|
||||||
the `rebase-cousins` mode is turned on, such commits are instead rebased
|
commits that would be excluded by linkgit:git-log[1]'s `--ancestry-path`
|
||||||
onto `<upstream>` (or `<onto>`, if specified).
|
option will keep their original ancestry by default. In `rebase-cousins` mode,
|
||||||
|
such commits are instead rebased onto `<upstream>` (or `<onto>`, if
|
||||||
|
specified).
|
||||||
+
|
+
|
||||||
It is currently only possible to recreate the merge commits using the
|
It is currently only possible to recreate the merge commits using the
|
||||||
`ort` merge strategy; different merge strategies can be used only via
|
`ort` merge strategy; different merge strategies can be used only via
|
||||||
|
@ -250,6 +250,16 @@ test_expect_success 'with a branch tip that was cherry-picked already' '
|
|||||||
EOF
|
EOF
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success '--no-rebase-merges countermands --rebase-merges' '
|
||||||
|
git checkout -b no-rebase-merges E &&
|
||||||
|
git rebase --rebase-merges --no-rebase-merges C &&
|
||||||
|
test_cmp_graph C.. <<-\EOF
|
||||||
|
* B
|
||||||
|
* D
|
||||||
|
o C
|
||||||
|
EOF
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'do not rebase cousins unless asked for' '
|
test_expect_success 'do not rebase cousins unless asked for' '
|
||||||
git checkout -b cousins main &&
|
git checkout -b cousins main &&
|
||||||
before="$(git rev-parse --verify HEAD)" &&
|
before="$(git rev-parse --verify HEAD)" &&
|
||||||
|
Loading…
Reference in New Issue
Block a user