Why did git-for-windows switch to the merging-rebase fork strategy? #4821
-
I came across the merging-rebase strategy used by git-for-windows in a GitHub blog post, which notes:
I found some wiki pages that document the strategy and some tools and tips on how to perform these rebases. But I'm very curious: why did @dscho develop this strategy to replace the simple merge strategy? What were the needs mentioned in the quote above? I am going to be maintaining a private fork of a public repository, and the answer will help me decide between the simple merge and the merging rebase strategies for our use case. Thank you in advance for sharing your experience! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 9 replies
-
The main reason to use rebases in the first place is to keep our patches in an upstreamable shape. A secondary reason is to make integrating new upstream versions easier: it is too easy to overlook when changes outside the merge conflicts are problematic, especially when entire commits become obsoleted by upstream commits. The challenge with rebases is that it would require force-pushing, and that just messes with PRs that are still in flight. So I invented first the rebasing merge (where it was easy to find out the latest rebased commit), and later switching to a merging rebase (where it is easy to find out the oldest rebased commit, which is a much more common question to answer). In |
Beta Was this translation helpful? Give feedback.
-
Thanks for the detailed answer @dscho, I'm also considering what strategy to choose for our in-house forks. Our repositories are not high-velocity so we do not have a lot of open PRs at any given time, so this advantage of merging-rebase is not super important too me. But, I'd really like if you would share your experience on how having the "whole" history reachable from the tip of the fork is valuable. That is, what do I gain by using a merging rebase strategy, that is not possible (or harder) if previous versions of the fork's main branch are just available as tags (i.e. we just do a regular Also, you write:
Is this workaround caused by the fact that having the original commits reachable somehow "confuses" the 3-way merge algorithm, and so it selects a non-ideal merge-base? Do you have concrete examples of when this workaround was needed? I have a feeling this is related to what Junio writes here... Thanks, |
Beta Was this translation helpful? Give feedback.
-
A personal viewpoint of the strategy is that:
Hopefully that doesn't conflict with Dscho's realpolitik of how it actually came about. [aside: a '--no-theirs' option when commit walking would essentially drop merges where there is a matching parent and child tree, and just follow the matching tree in the commit walk]. |
Beta Was this translation helpful? Give feedback.
The main reason to use rebases in the first place is to keep our patches in an upstreamable shape.
A secondary reason is to make integrating new upstream versions easier: it is too easy to overlook when changes outside the merge conflicts are problematic, especially when entire commits become obsoleted by upstream commits.
The challenge with rebases is that it would require force-pushing, and that just messes with PRs that are still in flight. So I invented first the rebasing merge (where it was easy to find out the latest rebased commit), and later switching to a merging rebase (where it is easy to find out the oldest rebased commit, which is a much more common question to answer).
In
mi…