Skip to content

Commit

Permalink
Merge branch 'js/rebase-deprecate-preserve-merges'
Browse files Browse the repository at this point in the history
"git rebase --rebase-merges" replaces its old "--preserve-merges"
option; the latter is now marked as deprecated.

* js/rebase-deprecate-preserve-merges:
  rebase: deprecate --preserve-merges
  • Loading branch information
gitster committed Apr 9, 2019
2 parents 20fe798 + 427c3bd commit fa1b86e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Documentation/config/branch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
linkgit:git-rebase[1] for details).
+
When preserve, also pass `--preserve-merges` along to 'git rebase'
so that locally committed merge commits will not be flattened
by running 'git pull'.
When `preserve` (deprecated in favor of `merges`), also pass
`--preserve-merges` along to 'git rebase' so that locally committed merge
commits will not be flattened by running 'git pull'.
+
When the value is `interactive`, the rebase is run in interactive mode.
+
Expand Down
6 changes: 3 additions & 3 deletions Documentation/config/pull.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
linkgit:git-rebase[1] for details).
+
When preserve, also pass `--preserve-merges` along to 'git rebase'
so that locally committed merge commits will not be flattened
by running 'git pull'.
When `preserve` (deprecated in favor of `merges`), also pass
`--preserve-merges` along to 'git rebase' so that locally committed merge
commits will not be flattened by running 'git pull'.
+
When the value is `interactive`, the rebase is run in interactive mode.
+
Expand Down
23 changes: 12 additions & 11 deletions Documentation/git-rebase.txt
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,9 @@ i.e. commits that would be excluded by linkgit:git-log[1]'s
the `rebase-cousins` mode is turned on, such commits are instead rebased
onto `<upstream>` (or `<onto>`, if specified).
+
The `--rebase-merges` mode is similar in spirit to `--preserve-merges`, but
in contrast to that option works well in interactive rebases: commits can be
reordered, inserted and dropped at will.
The `--rebase-merges` mode is similar in spirit to the deprecated
`--preserve-merges`, but in contrast to that option works well in interactive
rebases: commits can be reordered, inserted and dropped at will.
+
It is currently only possible to recreate the merge commits using the
`recursive` merge strategy; Different merge strategies can be used only via
Expand All @@ -427,9 +427,10 @@ See also REBASING MERGES and INCOMPATIBLE OPTIONS below.

-p::
--preserve-merges::
Recreate merge commits instead of flattening the history by replaying
commits a merge commit introduces. Merge conflict resolutions or manual
amendments to merge commits are not preserved.
[DEPRECATED: use `--rebase-merges` instead] Recreate merge commits
instead of flattening the history by replaying commits a merge commit
introduces. Merge conflict resolutions or manual amendments to merge
commits are not preserved.
+
This uses the `--interactive` machinery internally, but combining it
with the `--interactive` option explicitly is generally not a good
Expand Down Expand Up @@ -1020,11 +1021,11 @@ merge cmake

BUGS
----
The todo list presented by `--preserve-merges --interactive` does not
represent the topology of the revision graph. Editing commits and
rewording their commit messages should work fine, but attempts to
reorder commits tend to produce counterintuitive results. Use
`--rebase-merges` in such scenarios instead.
The todo list presented by the deprecated `--preserve-merges --interactive`
does not represent the topology of the revision graph (use `--rebase-merges`
instead). Editing commits and rewording their commit messages should work
fine, but attempts to reorder commits tend to produce counterintuitive results.
Use `--rebase-merges` in such scenarios instead.

For example, an attempt to rearrange
------------
Expand Down
8 changes: 6 additions & 2 deletions builtin/rebase.c
Original file line number Diff line number Diff line change
Expand Up @@ -1105,8 +1105,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
PARSE_OPT_NOARG | PARSE_OPT_NONEG,
parse_opt_interactive },
OPT_SET_INT('p', "preserve-merges", &options.type,
N_("try to recreate merges instead of ignoring "
"them"), REBASE_PRESERVE_MERGES),
N_("(DEPRECATED) try to recreate merges instead of "
"ignoring them"), REBASE_PRESERVE_MERGES),
OPT_BOOL(0, "rerere-autoupdate",
&options.allow_rerere_autoupdate,
N_("allow rerere to update index with resolved "
Expand Down Expand Up @@ -1217,6 +1217,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
usage_with_options(builtin_rebase_usage,
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)
die(_("No rebase in progress?"));
setenv(GIT_REFLOG_ACTION_ENVIRONMENT, "rebase", 0);
Expand Down

0 comments on commit fa1b86e

Please sign in to comment.