Skip to content

Commit 9fb99e6

Browse files
committed
rn-38: add Jake's articles about rebase and merges
1 parent 2acc423 commit 9fb99e6

File tree

1 file changed

+107
-3
lines changed

1 file changed

+107
-3
lines changed

‎rev_news/drafts/edition-38.md‎

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,114 @@ This edition covers what happened during the month of March 2018.
1717

1818
## Discussions
1919

20-
<!---
20+
2121
### General
22-
-->
2322

23+
*[rebase -i: offer to recreate merge commits](https://public-inbox.org/git/[email protected]/) (*written by Jacob Keller*)
24+
25+
Johannes Schindelin has worked to replace `--preserve-merges`
26+
functionality in `git rebase` which has many known flaws by a new
27+
`--recreate-merges` which aims to replace the functionality of
28+
`--preserve-merges` in a way that fixes the known issues.
29+
30+
When the patch series was sent to the list, Sergey Organov brought up
31+
that `--recreate-merges` is still (true to its name) recreating the
32+
merges from scratch, thus losing any content they might contain such
33+
as fixes.
34+
35+
He pointed to a strategy for cherry-picking the merge commmit. Others
36+
chimed in to say that they share concerns and would like to see the
37+
ability to preserve the merge resolutions properly.
38+
39+
Johannes replied that this does not make sense because the cherry-pick
40+
solution does not work when you drop or re-order commits. The goal of
41+
`--recreate-merges` is to allow the same level of freedom as with
42+
regular interactive rebases. Using the `--preserve-merges --first-parent`
43+
strategy of just cherry-picking the merge commit will
44+
result in any changes before that merge being dropped.
45+
46+
Junio Hamano, the Git maintainer, chimed in that Johannes was correct,
47+
if for example the side branch you are merging dropped a commit during
48+
the rebase, you absolutely do not want to use the simple `git cherry-pick -m1`
49+
original.
50+
51+
Sergey replied that he had only intended the use of cherry-pick as an
52+
explanation facility, and that a proper strategy would be required to
53+
actually implement and allow history editing.
54+
55+
Some discussion about `--preserve-merges` and compatibility with scripts
56+
(i.e. should we change or fix it? or should we deprecate it?)
57+
followed.
58+
59+
*[Rebasing merges: a jorney to the ultimate solution (Road Clear)](https://public-inbox.org/git/[email protected]/) (*written by Jacob Keller*)
60+
61+
After the discussions in the above article Sergey posted an
62+
outline of a potential method for actually rebasing a merge (as
63+
opposed to recreating it from scratch) which used a process of
64+
`git cherry-pick -mN` of the merge onto each topic branch being
65+
merged, and then merging the result.
66+
67+
Igor Djordjevic and Jacob Keller, alias Jake, chimed in hoping to
68+
prove by example that the solution could work. Johannes replied that
69+
he was skeptical and pointed out possible flaws.
70+
71+
A few examples were tried, but it was proven that the original concept
72+
did not work, as dropped commits could end up being replaid into the
73+
merge commits, turning them into "evil" merges.
74+
75+
Further suggestions to the strategy were proposed and tested,
76+
ultimately resulting in Sergey proposing the addition of using the
77+
original merge commit as a merge base during the final step.
78+
79+
Some discussion occurred about `merge -s ours` and how any rebasing
80+
strategy should avoid attempting to understand the semantics of the
81+
merges.
82+
83+
Phillip Wood suggested an alternative idea for keeping the merge
84+
conflicts by merging the changes from each rebased branch back into
85+
the parent merge branch. This was immediately understood by Johannes
86+
and suggested as a potential for the default implementation.
87+
88+
Sergey replied that he thinks the solution produces the same result as
89+
his updated strategy.
90+
91+
Johannes suggested that he was open to using Phillip's strategy but
92+
was worried about syntax. He did not want to introduce inconsistent
93+
behavior of the new "merge" command.
94+
95+
Despite Sergey believing that the two strategies were equivalent,
96+
Johannes was not convinced.
97+
98+
Discussion about the syntax for the new "rebase a merge" todo command
99+
continued. Johannes landed on the idea of adding an option to the
100+
merge line `-R` to indicate that it was rebasing a merge (vs creating
101+
a new merge).
102+
103+
Phillip suggested that we re-use "pick" but thought it might be a bit
104+
too magical. He then followed up that it is indeed too magical, and is
105+
basically the `--preserve-merges` mistake all over again. He suggested
106+
it was a shame to have merge mean both recreate a merge and rebase a
107+
merge, but didn't have a good answer.
108+
109+
Igor suggested that "pick" was more natural, and that we should extend
110+
it to properly support picking merge commits in a way that was not
111+
broken like `--perserve-merges`.
112+
113+
Johannes said he did not like the extension of "pick" because it makes
114+
it harder to understand which lines are actually merges and which
115+
are not.
116+
117+
Johannes replied that Sergey's strategy is actually worse than
118+
Phillip's functionally, because it has potential to produce conflicts
119+
multiple times. The discussion continued and became heated, with both
120+
Johannes and Sergey unable to come to consensus.
121+
122+
Discussion about pick vs `merge -R` continued, with Igor and Sergey
123+
stating that they thought extending pick syntax would be better than
124+
introducing `merge -R` syntax.
125+
126+
Some further discussion about backwards compatibility of the todo list
127+
format, and of options for it followed.
24128

25129
### Reviews
26130

@@ -211,4 +315,4 @@ Christian Couder &lt;<[email protected]>&gt;,
211315
Jakub Narębski &lt;<[email protected]>&gt;,
212316
Markus Jansen &lt;<[email protected]>&gt; and
213317
Gabriel Alcaras &lt;<[email protected]>&gt;
214-
with help from Jiang Xin.
318+
with help from Jiang Xin and Jacob Keller.

0 commit comments

Comments
(0)