From: Alex Henrie <alexhenrie24@gmail.com>
To: git@vger.kernel.org, tao@klerks.biz, gitster@pobox.com,
newren@gmail.com, phillip.wood123@gmail.com,
Johannes.Schindelin@gmx.de
Cc: Alex Henrie <alexhenrie24@gmail.com>
Subject: [PATCH v3 1/3] rebase: add documentation and tests for --no-rebase-merges
Date: Tue, 21 Feb 2023 22:17:07 -0700 [thread overview]
Message-ID: <20230222051709.464275-1-alexhenrie24@gmail.com> (raw)
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
Documentation/git-rebase.txt | 4 +++-
t/t3430-rebase-merges.sh | 25 +++++++++++++++++++++++++
2 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt
index 9a295bcee4..c98784a0d2 100644
--- a/Documentation/git-rebase.txt
+++ b/Documentation/git-rebase.txt
@@ -529,13 +529,15 @@ See also INCOMPATIBLE OPTIONS below.
-r::
--rebase-merges[=(rebase-cousins|no-rebase-cousins)]::
+--no-rebase-merges::
By default, a rebase will simply drop merge commits from the todo
list, and put the rebased commits into a single, linear branch.
With `--rebase-merges`, the rebase will instead try to preserve
the branching structure within the commits that are to be rebased,
by recreating the merge commits. Any resolved merge conflicts or
manual amendments in these merge commits will have to be
- resolved/re-applied manually.
+ resolved/re-applied manually. `--no-rebase-merges` can be used to
+ countermand a previous `--rebase-merges`.
+
By default, or when `no-rebase-cousins` was specified, commits which do not
have `<upstream>` as direct ancestor will keep their original branch point,
diff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh
index fa2a06c19f..e0d910c229 100755
--- a/t/t3430-rebase-merges.sh
+++ b/t/t3430-rebase-merges.sh
@@ -250,6 +250,31 @@ test_expect_success 'with a branch tip that was cherry-picked already' '
EOF
'
+test_expect_success 'do not rebase merges unless asked to' '
+ git checkout -b rebase-merges-default E &&
+ before="$(git rev-parse --verify HEAD)" &&
+ test_tick &&
+ git rebase --rebase-merges C &&
+ test_cmp_rev HEAD $before &&
+ test_tick &&
+ git rebase C &&
+ test_cmp_graph C.. <<-\EOF
+ * B
+ * D
+ o C
+ EOF
+'
+
+test_expect_success '--no-rebase-merges countermands --rebase-merges' '
+ git checkout -b no-rebase-merges E &&
+ git rebase --rebase-merges --no-rebase-merges C &&
+ test_cmp_graph C.. <<-\EOF
+ * B
+ * D
+ o C
+ EOF
+'
+
test_expect_success 'do not rebase cousins unless asked for' '
git checkout -b cousins main &&
before="$(git rev-parse --verify HEAD)" &&
--
2.39.2
next reply other threads:[~2023-02-22 5:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 5:17 Alex Henrie [this message]
2023-02-22 5:17 ` [PATCH v3 2/3] rebase: stop accepting --rebase-merges="" Alex Henrie
2023-02-22 23:56 ` Junio C Hamano
2023-02-23 5:35 ` Alex Henrie
2023-02-22 5:17 ` [PATCH v3 3/3] rebase: add a config option for --rebase-merges Alex Henrie
2023-02-23 0:12 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230222051709.464275-1-alexhenrie24@gmail.com \
--to=alexhenrie24@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=newren@gmail.com \
--cc=phillip.wood123@gmail.com \
--cc=tao@klerks.biz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.