Junio C Hamano
bd2bc94252
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 <mbox-for-topic-B
When topic-A gets updated, recreating the first merge and rebasing
the rest of the topic-B, all on detached HEAD, is a useful
technique. After updating topic-A with its new round of patches:
$ git checkout topic-B
$ prev=$(git rev-parse 'HEAD^{/^Merge branch .topic-A. into}')
$ git checkout --detach $prev^1
$ git merge --no-ff --no-edit topic-A
$ git rebase --onto HEAD $prev @{-1}^0
$ git checkout -B @{-1}
This will
(0) check out the current topic-B.
(1) find the previous merge of topic-A into topic-B.
(2) detach the HEAD to the parent of the previous merge.
(3) merge the updated topic-A to it.
(4) reapply the patches to rebuild the rest of topic-B.
(5) update topic-B with the result.
without contaminating the reflog of topic-B too much. topic-B@{1}
is the "logically previous" state before topic-A got updated, for
example. At (4), comparison (e.g. range-diff) between HEAD and
@{-1} is a meaningful way to sanity check the result, and the same
can be done at (5) by comparing topic-B and topic-B@{1}.
But there is one glitch. The merge into the detached HEAD done in
the step (3) above gives us "Merge branch 'topic-A' into HEAD", and
does not say "into topic-B".
Teach the "--into-name=<branch>" option to "git merge" and its
underlying "git fmt-merge-message", to pretend as if we were merging
into <branch>, no matter what branch we are actually merging into,
when they prepare the merge message. The pretend name honors the
usual "into <target>" suppression mechanism, which can be seen in
the tests added here.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-12-20 14:55:02 -08:00
..
2021-11-01 13:48:08 -07:00
2021-03-27 15:13:12 -07:00
2021-11-14 22:50:52 -08:00
2021-11-12 15:29:25 -08:00
2021-10-15 10:29:11 -07:00
2020-03-29 09:25:38 -07:00
2019-10-06 12:25:16 +09:00
2021-10-18 15:47:58 -07:00
2017-01-23 10:56:47 -08:00
2020-08-04 18:34:02 -07:00
2021-07-28 13:18:02 -07:00
2021-10-25 09:12:56 -07:00
2021-02-23 13:33:02 -08:00
2021-10-04 13:07:18 -07:00
2021-04-28 13:34:44 +09:00
2021-08-11 12:36:18 -07:00
2020-02-18 13:53:30 -08:00
2016-05-09 15:44:14 -07:00
2021-06-30 14:57:22 -07:00
2021-09-28 10:31:02 -07:00
2021-09-10 15:51:14 -07:00
2018-05-25 17:16:47 +09:00
2021-04-07 22:20:33 -07:00
2018-09-21 09:28:58 -07:00
2021-10-25 10:08:23 -07:00
2020-10-08 14:01:15 -07:00
2020-08-28 14:06:06 -07:00
2021-10-18 15:47:58 -07:00
2021-10-23 17:12:41 -07:00
2021-09-07 14:25:13 -07:00
2021-10-27 17:06:12 -07:00
2021-10-08 15:45:14 -07:00
2019-11-07 13:42:00 +09:00
2020-03-17 15:02:23 -07:00
2021-01-12 14:04:40 -08:00
2019-04-02 13:57:00 +09:00
2021-09-27 13:38:37 -07:00
2020-10-20 11:57:40 -07:00
2013-11-27 12:16:49 -08:00
2019-10-11 14:24:46 +09:00
2021-04-01 12:58:58 -07:00
2021-08-26 14:36:27 -07:00
2020-11-02 13:17:39 -08:00
2020-04-03 11:37:22 -07:00
2021-10-29 11:22:56 -07:00
2021-09-13 14:51:07 -07:00
2016-10-10 13:52:37 -07:00
2014-09-16 11:11:58 -07:00
2018-05-25 17:16:47 +09:00
2020-05-08 14:25:01 -07:00
2021-04-10 23:36:34 -07:00
2013-02-01 13:53:33 -08:00
2016-10-03 13:22:25 -07:00
2021-09-16 20:47:48 -07:00
2019-03-13 11:14:22 +09:00
2021-05-17 15:56:29 +09:00
2020-09-20 21:30:26 -07:00
2020-09-21 13:37:03 -07:00
2021-07-12 13:55:29 -07:00
2021-02-22 13:35:49 -08:00
2020-06-25 14:19:23 -07:00
2020-10-04 12:56:29 -07:00
2018-04-09 14:15:02 +09:00
2021-07-30 09:08:12 -07:00
2020-10-20 12:22:25 -07:00
2021-12-20 14:55:02 -08:00
2021-07-26 12:01:25 -07:00
2020-09-25 10:59:44 -07:00
2021-10-23 14:33:20 -07:00
2021-01-20 19:10:42 -08:00
2021-02-10 23:43:55 -08:00
2015-10-16 15:27:52 -07:00
2021-04-10 23:36:34 -07:00
2019-10-06 09:45:02 +09:00
2019-05-28 10:47:42 -07:00
2021-09-23 10:30:43 -07:00
2021-09-10 15:34:59 -07:00
2021-02-22 12:07:40 -08:00
2018-05-02 17:03:33 +09:00
2020-08-31 11:44:33 -07:00
2021-09-07 10:59:23 -07:00
2013-02-01 13:53:33 -08:00
2020-12-13 15:53:50 -08:00
2019-01-28 10:57:44 -08:00
2021-05-04 12:09:43 +09:00
2021-06-08 13:34:48 +09:00
2021-01-23 11:48:20 -08:00
2020-06-25 09:18:53 -07:00
2020-11-04 14:04:44 -08:00
2021-05-10 15:06:22 +09:00
2016-06-06 11:14:43 -07:00
2021-09-07 10:57:04 -07:00
2019-09-09 11:05:51 -07:00
2015-10-29 12:10:23 -07:00
2019-09-09 11:05:52 -07:00
2013-09-04 15:02:56 -07:00
2021-12-20 14:55:02 -08:00
2021-02-09 14:09:16 -08:00
2021-03-13 15:34:32 -08:00
2021-04-10 23:36:34 -07:00
2018-04-09 14:15:07 +09:00
2021-10-25 11:06:56 -07:00
2016-06-28 08:20:52 -07:00
2018-05-02 17:03:33 +09:00
2020-08-03 12:40:09 -07:00
2021-04-10 23:36:34 -07:00
2021-07-08 13:15:03 -07:00
2013-07-18 16:23:46 -07:00
2017-07-28 14:41:32 -07:00
2014-10-13 13:35:18 -07:00
2018-05-02 17:03:33 +09:00
2021-10-18 15:47:56 -07:00
2021-07-16 17:42:53 -07:00
2019-01-07 15:29:34 -08:00
2021-02-17 17:21:41 -08:00
2021-09-27 13:38:37 -07:00
2021-10-18 15:47:56 -07:00
2021-08-05 08:59:37 -07:00
2018-10-22 13:32:54 +09:00
2019-04-22 11:14:46 +09:00
2019-04-01 14:00:53 +09:00
2019-04-01 14:00:53 +09:00
2020-10-27 11:40:33 -07:00
2021-09-28 21:20:56 -07:00
2019-09-05 13:01:48 -07:00
2018-05-02 17:03:33 +09:00
2019-07-09 15:25:44 -07:00
2021-09-27 13:38:37 -07:00
2020-10-07 09:49:05 -07:00
2021-02-17 16:25:29 -08:00
2020-12-12 23:35:51 -08:00
2020-10-20 11:57:40 -07:00
2021-09-28 10:31:02 -07:00
2021-05-17 07:06:13 +09:00
2021-09-12 18:57:30 -07:00
2012-03-28 11:18:35 -07:00
2016-06-08 12:04:37 -07:00
2018-05-02 17:03:33 +09:00
2021-02-10 13:34:51 -08:00
2019-04-10 12:05:03 +09:00
2020-08-17 10:50:14 -07:00
2019-01-10 10:29:05 -08:00
2020-12-21 13:47:32 -08:00
2021-09-07 22:41:10 -07:00
2014-10-13 13:35:18 -07:00
2021-05-22 17:56:46 +09:00
2021-10-13 15:15:58 -07:00
2015-10-16 15:27:52 -07:00
2020-06-24 09:14:21 -07:00
2021-09-07 21:45:33 -07:00
2020-10-08 09:25:29 -07:00
2012-10-21 12:17:38 -07:00
2021-02-19 19:36:47 -08:00
2017-04-20 22:05:37 -07:00
2016-08-24 12:31:05 -07:00
2021-01-09 22:57:24 -08:00
2020-11-16 13:44:01 -08:00
2019-05-15 14:07:37 +09:00
2015-10-22 10:16:12 -07:00
2021-09-23 13:44:47 -07:00
2018-05-02 17:03:33 +09:00
2016-07-06 13:06:36 -07:00
2015-05-17 11:24:57 -07:00
2017-01-17 16:10:22 -08:00
2021-09-14 10:05:40 -07:00
2019-03-13 11:14:22 +09:00
2013-08-13 09:01:54 -07:00
2021-07-28 13:17:58 -07:00
2021-10-29 15:43:14 -07:00
2021-05-04 11:52:03 +09:00
2020-03-17 15:02:24 -07:00
2020-01-08 08:56:40 -08:00
2020-08-04 18:34:01 -07:00
2017-02-15 12:54:20 -08:00
2021-03-22 14:00:24 -07:00
2020-06-25 09:18:53 -07:00
2021-08-05 15:35:02 -07:00
2017-02-09 15:14:01 -08:00
2021-03-01 09:02:01 -08:00
2021-10-25 11:06:56 -07:00
2020-11-01 15:54:14 -08:00
2021-05-04 11:52:03 +09:00
2021-05-04 11:52:03 +09:00
2021-04-10 23:36:34 -07:00
2020-07-06 22:09:13 -07:00
2019-11-10 18:02:14 +09:00
2018-08-31 14:04:06 -07:00
2020-10-04 12:54:07 -07:00
2019-05-07 13:04:48 +09:00
2021-07-30 09:08:12 -07:00
2021-04-08 15:54:26 -07:00
2021-10-25 11:06:57 -07:00
2020-07-18 13:43:34 -07:00
2021-05-19 21:11:49 +09:00
2014-04-17 11:14:57 -07:00
2021-02-24 15:21:25 -08:00
2017-12-12 16:49:40 -08:00
2014-04-17 11:14:58 -07:00
2020-11-01 15:54:14 -08:00
2020-11-01 15:54:14 -08:00
2021-10-15 10:29:11 -07:00
2021-10-15 10:16:57 -07:00
2021-10-15 10:16:57 -07:00
2021-10-29 15:43:13 -07:00
2020-03-29 09:25:38 -07:00
2020-03-29 09:25:38 -07:00
2019-09-16 12:20:39 -07:00
2021-10-29 11:22:56 -07:00
2021-08-05 15:35:02 -07:00
2021-09-22 14:25:05 -07:00
2021-10-12 13:51:29 -07:00
2020-08-17 10:50:14 -07:00
2021-05-16 21:05:24 +09:00
2021-10-29 14:35:59 -07:00
2020-09-30 14:52:00 -07:00
2020-09-18 15:41:56 -07:00
2020-07-08 22:08:54 -07:00
2021-11-11 12:34:41 -08:00
2021-05-18 10:08:03 +09:00
2019-07-02 12:08:08 -07:00
2020-10-20 11:57:40 -07:00
2021-07-22 12:53:14 -07:00
2017-01-23 10:56:53 -08:00
2019-10-04 09:26:42 +09:00
2016-11-14 11:23:07 -08:00
2015-10-22 10:16:12 -07:00
2019-10-21 12:02:39 +09:00
2020-03-31 16:08:02 -07:00
2021-08-05 15:35:02 -07:00