Skip to content

Commit 427c3bd

Browse files
dschogitster
authored andcommitted
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>
1 parent 6053c04 commit 427c3bd

File tree

4 files changed

+24
-19
lines changed

4 files changed

+24
-19
lines changed

Documentation/config/branch.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ When `merges`, pass the `--rebase-merges` option to 'git rebase'
8585
so that the local merge commits are included in the rebase (see
8686
linkgit:git-rebase[1] for details).
8787
+
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'.
9191
+
9292
When the value is `interactive`, the rebase is run in interactive mode.
9393
+

Documentation/config/pull.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ When `merges`, pass the `--rebase-merges` option to 'git rebase'
1818
so that the local merge commits are included in the rebase (see
1919
linkgit:git-rebase[1] for details).
2020
+
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'.
2424
+
2525
When the value is `interactive`, the rebase is run in interactive mode.
2626
+

Documentation/git-rebase.txt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,9 @@ i.e. commits that would be excluded by gitlink:git-log[1]'s
415415
the `rebase-cousins` mode is turned on, such commits are instead rebased
416416
onto `<upstream>` (or `<onto>`, if specified).
417417
+
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.
421421
+
422422
It is currently only possible to recreate the merge commits using the
423423
`recursive` merge strategy; Different merge strategies can be used only via
@@ -427,9 +427,10 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below.
427427

428428
-p::
429429
--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.
433434
+
434435
This uses the `--interactive` machinery internally, but combining it
435436
with the `--interactive` option explicitly is generally not a good
@@ -1020,11 +1021,11 @@ merge cmake
10201021

10211022
BUGS
10221023
----
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.
10281029

10291030
For example, an attempt to rearrange
10301031
------------

builtin/rebase.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,8 +1100,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
11001100
PARSE_OPT_NOARG | PARSE_OPT_NONEG,
11011101
parse_opt_interactive },
11021102
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),
11051105
OPT_BOOL(0, "rerere-autoupdate",
11061106
&options.allow_rerere_autoupdate,
11071107
N_("allow rerere to update index with resolved "
@@ -1212,6 +1212,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
12121212
usage_with_options(builtin_rebase_usage,
12131213
builtin_rebase_options);
12141214

1215+
if (options.type == REBASE_PRESERVE_MERGES)
1216+
warning(_("git rebase --preserve-merges is deprecated. "
1217+
"Use --rebase-merges instead."));
1218+
12151219
if (action != NO_ACTION && !in_progress)
12161220
die(_("No rebase in progress?"));
12171221
setenv(GIT_REFLOG_ACTION_ENVIRONMENT, "rebase", 0);

0 commit comments

Comments
 (0)