From bd2bc94252a47443e19d366f8cc9626d4f92df7a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 20 Dec 2021 14:53:43 -0800 Subject: merge: allow to pretend a merge is made into a different branch When a series of patches for a topic-B depends on having topic-A, the workflow to prepare the topic-B branch would look like this: $ git checkout -b topic-B main $ git merge --no-ff --no-edit topic-A $ git am " option to "git merge" and its underlying "git fmt-merge-message", to pretend as if we were merging into , no matter what branch we are actually merging into, when they prepare the merge message. The pretend name honors the usual "into " suppression mechanism, which can be seen in the tests added here. Signed-off-by: Junio C Hamano --- Documentation/git-fmt-merge-msg.txt | 6 +++++- Documentation/git-merge.txt | 8 +++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-fmt-merge-msg.txt b/Documentation/git-fmt-merge-msg.txt index 6793d8fc05..6f28812f38 100644 --- a/Documentation/git-fmt-merge-msg.txt +++ b/Documentation/git-fmt-merge-msg.txt @@ -9,7 +9,7 @@ git-fmt-merge-msg - Produce a merge commit message SYNOPSIS -------- [verse] -'git fmt-merge-msg' [-m ] [--log[=] | --no-log] +'git fmt-merge-msg' [-m ] [--into-name ] [--log[=] | --no-log] 'git fmt-merge-msg' [-m ] [--log[=] | --no-log] -F DESCRIPTION @@ -44,6 +44,10 @@ OPTIONS Use instead of the branch names for the first line of the log message. For use with `--log`. +--into-name :: + Prepare the merge message as if merging to the branch ``, + instead of the name of the real branch to which the merge is made. + -F :: --file :: Take the list of merged objects from instead of diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index e4f3352eb5..ed0990621f 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -12,7 +12,8 @@ SYNOPSIS 'git merge' [-n] [--stat] [--no-commit] [--squash] [--[no-]edit] [--no-verify] [-s ] [-X ] [-S[]] [--[no-]allow-unrelated-histories] - [--[no-]rerere-autoupdate] [-m ] [-F ] [...] + [--[no-]rerere-autoupdate] [-m ] [-F ] + [--into-name ] [...] 'git merge' (--continue | --abort | --quit) DESCRIPTION @@ -76,6 +77,11 @@ The 'git fmt-merge-msg' command can be used to give a good default for automated 'git merge' invocations. The automated message can include the branch description. +--into-name :: + Prepare the default merge message as if merging to the branch + ``, instead of the name of the real branch to which + the merge is made. + -F :: --file=:: Read the commit message to be used for the merge commit (in -- cgit v1.3