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>
Johannes Schindelin committed
Mar 11, 2019 at 12:57 UTC
427c3bd28ab504443d0eea6fc6aa27b0c0748372
4 files changed
+24
-19
Documentation/config/branch.txt
+3
-3
@@ -85,9 +85,9 @@ When `merges`, pass the `--rebase-merges` option to 'git rebase'
85
so that the local merge commits are included in the rebase (see
86
linkgit:git-rebase[1] for details).
87
+
88
-When preserve, also pass `--preserve-merges` along to 'git rebase'
89
-so that locally committed merge commits will not be flattened
90
-by running 'git pull'.
88
+When `preserve` (deprecated in favor of `merges`), also pass
89
+`--preserve-merges` along to 'git rebase' so that locally committed merge
90
+commits will not be flattened by running 'git pull'.
91
+
92
When the value is `interactive`, the rebase is run in interactive mode.
93
+
Documentation/config/pull.txt
+3
-3
@@ -18,9 +18,9 @@ When `merges`, pass the `--rebase-merges` option to 'git rebase'
18
so that the local merge commits are included in the rebase (see
19
linkgit:git-rebase[1] for details).
20
+
21
-When preserve, also pass `--preserve-merges` along to 'git rebase'
22
-so that locally committed merge commits will not be flattened
23
-by running 'git pull'.
21
+When `preserve` (deprecated in favor of `merges`), also pass
22
+`--preserve-merges` along to 'git rebase' so that locally committed merge
23
+commits will not be flattened by running 'git pull'.
24
+
25
When the value is `interactive`, the rebase is run in interactive mode.
26
+
Documentation/git-rebase.txt
+12
-11
@@ -415,9 +415,9 @@ i.e. commits that would be excluded by gitlink:git-log[1]'s
415
the `rebase-cousins` mode is turned on, such commits are instead rebased
416
onto `<upstream>` (or `<onto>`, if specified).
417
+
418
-The `--rebase-merges` mode is similar in spirit to `--preserve-merges`, but
419
-in contrast to that option works well in interactive rebases: commits can be
420
-reordered, inserted and dropped at will.
418
+The `--rebase-merges` mode is similar in spirit to the deprecated
419
+`--preserve-merges`, but in contrast to that option works well in interactive
420
+rebases: commits can be reordered, inserted and dropped at will.
421
+
422
It is currently only possible to recreate the merge commits using the
423
`recursive` merge strategy; Different merge strategies can be used only via
@@ -427,9 +427,10 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below.
427
428
-p::
429
--preserve-merges::
430
- Recreate merge commits instead of flattening the history by replaying
431
- commits a merge commit introduces. Merge conflict resolutions or manual
432
- amendments to merge commits are not preserved.
430
+ [DEPRECATED: use `--rebase-merges` instead] Recreate merge commits
431
+ instead of flattening the history by replaying commits a merge commit
432
+ introduces. Merge conflict resolutions or manual amendments to merge
433
+ commits are not preserved.
434
+
435
This uses the `--interactive` machinery internally, but combining it
436
with the `--interactive` option explicitly is generally not a good
@@ -1020,11 +1021,11 @@ merge cmake
1021
1022
BUGS
1023
----
1023
-The todo list presented by `--preserve-merges --interactive` does not
1024
-represent the topology of the revision graph. Editing commits and
1025
-rewording their commit messages should work fine, but attempts to
1026
-reorder commits tend to produce counterintuitive results. Use
1027
-`--rebase-merges` in such scenarios instead.
1024
+The todo list presented by the deprecated `--preserve-merges --interactive`
1025
+does not represent the topology of the revision graph (use `--rebase-merges`
1026
+instead). Editing commits and rewording their commit messages should work
1027
+fine, but attempts to reorder commits tend to produce counterintuitive results.
1028
+Use `--rebase-merges` in such scenarios instead.
1029
1030
For example, an attempt to rearrange
1031
------------
builtin/rebase.c
+6
-2
@@ -1100,8 +1100,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1100
PARSE_OPT_NOARG | PARSE_OPT_NONEG,
1101
parse_opt_interactive },
1102
OPT_SET_INT('p', "preserve-merges", &options.type,
1103
- N_("try to recreate merges instead of ignoring "
1104
- "them"), REBASE_PRESERVE_MERGES),
1103
+ N_("(DEPRECATED) try to recreate merges instead of "
1104
+ "ignoring them"), REBASE_PRESERVE_MERGES),
1105
OPT_BOOL(0, "rerere-autoupdate",
1106
&options.allow_rerere_autoupdate,
1107
N_("allow rerere to update index with resolved "
@@ -1212,6 +1212,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1212
usage_with_options(builtin_rebase_usage,
1213
builtin_rebase_options);
1214
1215
+ if (options.type == REBASE_PRESERVE_MERGES)
1216
+ warning(_("git rebase --preserve-merges is deprecated. "
1217
+ "Use --rebase-merges instead."));
1218
+
1219
if (action != NO_ACTION && !in_progress)
1220
die(_("No rebase in progress?"));
1221
setenv(GIT_REFLOG_ACTION_ENVIRONMENT, "rebase", 0);