rebase: deprecate --preserve-merges

We have something much better now: --rebase-merges (which is a
complete re-design --preserve-merges, with a lot of issues fixed such as
the inability to reorder commits with --preserve-merges).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin 2019-03-11 12:57:35 -07:00 committed by Junio C Hamano
parent 6053c04b88
commit 427c3bd28a
4 changed files with 24 additions and 19 deletions

View File

@ -85,9 +85,9 @@ When `merges`, pass the `--rebase-merges` option to 'git rebase'
so that the local merge commits are included in the rebase (see so that the local merge commits are included in the rebase (see
linkgit:git-rebase[1] for details). linkgit:git-rebase[1] for details).
+ +
When preserve, also pass `--preserve-merges` along to 'git rebase' When `preserve` (deprecated in favor of `merges`), also pass
so that locally committed merge commits will not be flattened `--preserve-merges` along to 'git rebase' so that locally committed merge
by running 'git pull'. commits will not be flattened by running 'git pull'.
+ +
When the value is `interactive`, the rebase is run in interactive mode. When the value is `interactive`, the rebase is run in interactive mode.
+ +

View File

@ -18,9 +18,9 @@ When `merges`, pass the `--rebase-merges` option to 'git rebase'
so that the local merge commits are included in the rebase (see so that the local merge commits are included in the rebase (see
linkgit:git-rebase[1] for details). linkgit:git-rebase[1] for details).
+ +
When preserve, also pass `--preserve-merges` along to 'git rebase' When `preserve` (deprecated in favor of `merges`), also pass
so that locally committed merge commits will not be flattened `--preserve-merges` along to 'git rebase' so that locally committed merge
by running 'git pull'. commits will not be flattened by running 'git pull'.
+ +
When the value is `interactive`, the rebase is run in interactive mode. When the value is `interactive`, the rebase is run in interactive mode.
+ +

View File

@ -415,9 +415,9 @@ i.e. commits that would be excluded by gitlink:git-log[1]'s
the `rebase-cousins` mode is turned on, such commits are instead rebased the `rebase-cousins` mode is turned on, such commits are instead rebased
onto `<upstream>` (or `<onto>`, if specified). onto `<upstream>` (or `<onto>`, if specified).
+ +
The `--rebase-merges` mode is similar in spirit to `--preserve-merges`, but The `--rebase-merges` mode is similar in spirit to the deprecated
in contrast to that option works well in interactive rebases: commits can be `--preserve-merges`, but in contrast to that option works well in interactive
reordered, inserted and dropped at will. rebases: commits can be reordered, inserted and dropped at will.
+ +
It is currently only possible to recreate the merge commits using the It is currently only possible to recreate the merge commits using the
`recursive` merge strategy; Different merge strategies can be used only via `recursive` merge strategy; Different merge strategies can be used only via
@ -427,9 +427,10 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below.
-p:: -p::
--preserve-merges:: --preserve-merges::
Recreate merge commits instead of flattening the history by replaying [DEPRECATED: use `--rebase-merges` instead] Recreate merge commits
commits a merge commit introduces. Merge conflict resolutions or manual instead of flattening the history by replaying commits a merge commit
amendments to merge commits are not preserved. introduces. Merge conflict resolutions or manual amendments to merge
commits are not preserved.
+ +
This uses the `--interactive` machinery internally, but combining it This uses the `--interactive` machinery internally, but combining it
with the `--interactive` option explicitly is generally not a good with the `--interactive` option explicitly is generally not a good
@ -1020,11 +1021,11 @@ merge cmake
BUGS BUGS
---- ----
The todo list presented by `--preserve-merges --interactive` does not The todo list presented by the deprecated `--preserve-merges --interactive`
represent the topology of the revision graph. Editing commits and does not represent the topology of the revision graph (use `--rebase-merges`
rewording their commit messages should work fine, but attempts to instead). Editing commits and rewording their commit messages should work
reorder commits tend to produce counterintuitive results. Use fine, but attempts to reorder commits tend to produce counterintuitive results.
`--rebase-merges` in such scenarios instead. Use `--rebase-merges` in such scenarios instead.
For example, an attempt to rearrange For example, an attempt to rearrange
------------ ------------

View File

@ -1100,8 +1100,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
PARSE_OPT_NOARG | PARSE_OPT_NONEG, PARSE_OPT_NOARG | PARSE_OPT_NONEG,
parse_opt_interactive }, parse_opt_interactive },
OPT_SET_INT('p', "preserve-merges", &options.type, OPT_SET_INT('p', "preserve-merges", &options.type,
N_("try to recreate merges instead of ignoring " N_("(DEPRECATED) try to recreate merges instead of "
"them"), REBASE_PRESERVE_MERGES), "ignoring them"), REBASE_PRESERVE_MERGES),
OPT_BOOL(0, "rerere-autoupdate", OPT_BOOL(0, "rerere-autoupdate",
&options.allow_rerere_autoupdate, &options.allow_rerere_autoupdate,
N_("allow rerere to update index with resolved " N_("allow rerere to update index with resolved "
@ -1212,6 +1212,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
usage_with_options(builtin_rebase_usage, usage_with_options(builtin_rebase_usage,
builtin_rebase_options); builtin_rebase_options);
if (options.type == REBASE_PRESERVE_MERGES)
warning(_("git rebase --preserve-merges is deprecated. "
"Use --rebase-merges instead."));
if (action != NO_ACTION && !in_progress) if (action != NO_ACTION && !in_progress)
die(_("No rebase in progress?")); die(_("No rebase in progress?"));
setenv(GIT_REFLOG_ACTION_ENVIRONMENT, "rebase", 0); setenv(GIT_REFLOG_ACTION_ENVIRONMENT, "rebase", 0);