diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index 8c1f4b8268..f7a6033607 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -699,6 +699,16 @@ suffer from the same shortcoming. (See https://lore.kernel.org/git/20200207132152.GC2868@szeder.dev/ for details.) +Commit Rewording +~~~~~~~~~~~~~~~~ + +When a conflict occurs while rebasing, rebase stops and asks the user +to resolve. Since the user may need to make notable changes while +resolving conflicts, after conflicts are resolved and the user has run +`git rebase --continue`, the rebase should open an editor and ask the +user to update the commit message. The merge backend does this, while +the apply backend blindly applies the original commit message. + Miscellaneous differences ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/builtin/rebase.c b/builtin/rebase.c index cb7aeae597..bff53d5d16 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1543,7 +1543,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) "ignoring them"), REBASE_PRESERVE_MERGES, PARSE_OPT_HIDDEN), OPT_RERERE_AUTOUPDATE(&options.allow_rerere_autoupdate), - OPT_CALLBACK_F(0, "empty", &options, N_("{drop,keep,ask}"), + OPT_CALLBACK_F(0, "empty", &options, "{drop,keep,ask}", N_("how to handle commits that become empty"), PARSE_OPT_NONEG, parse_opt_empty), { OPTION_CALLBACK, 'k', "keep-empty", &options, NULL, diff --git a/sequencer.c b/sequencer.c index 7477b15422..e528225e78 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1957,6 +1957,8 @@ static int do_pick_commit(struct repository *r, flags |= ALLOW_EMPTY; } else if (allow == 2) { drop_commit = 1; + unlink(git_path_cherry_pick_head(r)); + unlink(git_path_merge_msg(r)); fprintf(stderr, _("dropping %s %s -- patch contents already upstream\n"), oid_to_hex(&commit->object.oid), msg.subject); diff --git a/t/t3424-rebase-empty.sh b/t/t3424-rebase-empty.sh index 98fc2a558a..e1e30517ea 100755 --- a/t/t3424-rebase-empty.sh +++ b/t/t3424-rebase-empty.sh @@ -123,4 +123,12 @@ test_expect_success 'rebase --interactive uses default of --empty=ask' ' test_cmp expect actual ' +test_expect_success 'rebase --merge does not leave state laying around' ' + git checkout -B testing localmods~2 && + git rebase --merge upstream && + + test_path_is_missing .git/CHERRY_PICK_HEAD && + test_path_is_missing .git/MERGE_MSG +' + test_done